package com.shop2cn.iapi.sqoptrade.testcase;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.ymttest.business.service.shenqi.*;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.common.collect.Lists;
import com.shop2cn.iapi.liveordermanage.enums.LiveSourceEnum;
import com.shop2cn.iapi.points.enums.PointsBizTypeEnum;
import com.shop2cn.iapi.points.pojo.CreditPolicy;
import com.shop2cn.iapi.shenqisettlement.parameter.bean.AgentProductBean;
import com.shop2cn.iapi.sqoptrade.parameter.enums.ActivityTypeEnum;
import com.shop2cn.iapi.sqoptrade.parameter.enums.CouponApplianceTypeEnum;
import com.shop2cn.iapi.sqoptrade.parameter.enums.CouponSourceEnum;
import com.shop2cn.iapi.sqoptrade.parameter.enums.CouponTypeEnum;
import com.shop2cn.iapi.sqoptrade.parameter.enums.PromotionTypeEnum;
import com.shop2cn.iapi.sqoptrade.parameter.enums.ReduceProdStocksStatusEnum;
import com.shop2cn.iapi.sqoptrade.parameter.req.PlaceOrderReq;
import com.shop2cn.iapi.sqoptrade.parameter.vo.ActivityVo;
import com.shop2cn.iapi.sqoptrade.parameter.vo.CatalogApportionVo;
import com.shop2cn.iapi.sqoptrade.parameter.vo.CouponVo;
import com.shop2cn.iapi.sqoptrade.parameter.vo.OrderGroupVo;
import com.shop2cn.iapi.sqoptrade.parameter.vo.OrderItemVo;
import com.shop2cn.iapi.sqoptrade.parameter.vo.OrderVo;
import com.shop2cn.iapi.sqoptrade.parameter.vo.PickInStoreVo;
import com.shop2cn.iapi.sqoptrade.parameter.vo.SellerPromotionVo;
import com.shop2cn.iapi.sqoptrade.parameter.vo.TravelerVo;
import com.shop2cn.iapi.sqoptrade.service.PlaceOrderCall;
import com.shop2cn.iapi.sqoptrade.verify.DGSQPlaceOrderVerifyService;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.AccountCallServiceV2;
import com.ymttest.business.service.shenqi.bean.ShenqiUserSet;
import com.ymttest.database.sharding.db.sharding.model.MainOrderPo;
import com.ymttest.database.sharding.db.sqlwapper.OrderShardingWapper;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;

public class Ts_DGSQPlaceOrder {

	private static PlaceOrderReq placeOrderReq;
	private static PlaceOrderCall placeorderCall;

	private static OrderShardingWapper orderShardingWapper = new OrderShardingWapper();

	private static long autotest_goodsOwnerId = ShenqiUserSet.autotest_goodsOwnerId;
	private static long yabandGoodsOwnerId = ShenqiUserSet.yabandGoodsOwnerId;
	private static long chainStoreGoodsOwnerId = ShenqiUserSet.chainStoreGoodsOwnerId;
	private static long platformSupplierGoodsOwnerId = ShenqiUserSet.platformSupplierGoodsOwnerId;

	String key = "1234567890123456";

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("创建订单(新)接口");

		String accountid1;
		try {
			accountid1 = AccountCallServiceV2.getAccountId(20238699);
			AccountCallServiceV2.resetAccount(accountid1, new BigDecimal(
					9000000), new BigDecimal(0));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	@Before
	public void caseUp() {
		placeOrderReq = new PlaceOrderReq();
		placeorderCall = new PlaceOrderCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(placeorderCall.getOpurl());
		orderShardingWapper.activeDeadCommunicationsLink(orderShardingWapper);
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	public void verify() throws Exception {

		DGSQPlaceOrderVerifyService sqPlaceOrderVerifyService = new DGSQPlaceOrderVerifyService(
				placeOrderReq, placeorderCall);

		sqPlaceOrderVerifyService.verify();
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_001() {
		Logger.start(true, "渠道商一次下单一个商品, 导购订单，生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 2, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(1234L, BigDecimal.ZERO,
							20238699, productBean, autotest_goodsOwnerId);

			placeOrderReq.setGuideOrder(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_002() {
		Logger.start(true, "goodOwnerId与代理链不一致，下单失败");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, 3383);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(201, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(198, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(
					true,
					placeorderCall.getMsg().contains(
							"goodOwnerId mismatch in proxy chain"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_003() {
		Logger.start(true, "shopOwnerId与代理链不一致，下单失败");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);
			productBean.setSellerId(500058147L);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, (int) autotest_goodsOwnerId);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(201, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(198, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(
					true,
					placeorderCall.getMsg().contains(
							"Failed to fetch proxy chain"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_004() {
		Logger.start(true, "商品的成交价小于代理价， 下单失败");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, (int) autotest_goodsOwnerId);

			// 修改商品的成交价格
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setProductPrice(BigDecimal.ONE);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(201, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(198, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("商品的成交价小于代理价"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_005() {
		Logger.start(true, "一次下单多个商品,生成一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			OrderItemVo orderItemVo = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo);

			placeOrderReq.setDiscount(new BigDecimal("10.00"));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_006() {
		Logger.start(true, "商品的货主未提供");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setGoodsOwnerId(0L);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("商品的货主未提供"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_007() {
		Logger.start(true, "同一个订单，不同的代理链，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0);
			OrderItemVo orderItemVo = SqTradingCallService
					.createOrderItemVo(productBean2.getProductId(),
							productBean2.getCatalogList().get(0));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(201, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(198, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(
					true,
					placeorderCall.getMsg().contains(
							"Failed to fetch proxy chain"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_008() {
		Logger.start(true, "一次下单多个商品,生产两个订单，同一个买手");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			OrderVo orderVo = SqTradingCallService.createOrderVo(Lists
					.newArrayList(productBean));

			orderVo.getOrderItems().get(0)
					.setProductId(productBean.getProductId());
			orderVo.getOrderItems().get(0)
					.setCatalogId(productBean.getCatalogList().get(1));

			orderVo.setGoodsOwnerId(autotest_goodsOwnerId);
			orderVo.setShenqiLogisticsType(100);
			orderVo.setShenqiIdCardRequirement(0);

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_009() {
		Logger.start(true, "一次下单多个商品,生产两个订单，同一个买手使用折扣上调");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			OrderVo orderVo = SqTradingCallService.createOrderVo(Lists
					.newArrayList(productBean));

			orderVo.getOrderItems().get(0)
					.setProductId(productBean.getProductId());
			orderVo.getOrderItems().get(0)
					.setCatalogId(productBean.getCatalogList().get(1));

			orderVo.setGoodsOwnerId(autotest_goodsOwnerId);
			orderVo.setShenqiLogisticsType(100);
			orderVo.setShenqiIdCardRequirement(0);

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);

			placeOrderReq.setDiscount(new BigDecimal("10.00"));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_010() {
		Logger.start(true, "一次下单多个商品,生产两个订单，同一个买手使用折扣下调");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			int csId = SqTradingCallService.bindClientService(
					productBean.getSellerId(), 1);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(csId, BigDecimal.ZERO,
							20238699, productBean, autotest_goodsOwnerId);

			OrderVo orderVo = SqTradingCallService.createOrderVo(Lists
					.newArrayList(productBean));

			orderVo.getOrderItems().get(0)
					.setProductId(productBean.getProductId());
			orderVo.getOrderItems().get(0)
					.setCatalogId(productBean.getCatalogList().get(1));

			orderVo.setGoodsOwnerId(autotest_goodsOwnerId);
			orderVo.setShenqiLogisticsType(100);
			orderVo.setShenqiIdCardRequirement(0);

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);

			placeOrderReq.setDiscount(new BigDecimal("-10.00"));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_011() {
		Logger.start(true, "一次下单多个买手，下单报错");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			int secondGoodsOwnerId = 500042327;
			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createProxychain(secondGoodsOwnerId, 1, false);
			OrderGroupVo orderGroupVo = SqTradingCallService
					.createOrderGroupVo(productBean2, secondGoodsOwnerId);

			placeOrderReq.getOrderGroups().add(orderGroupVo);

			placeOrderReq.setDiscount(new BigDecimal("10.00"));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("不能有来自多个店铺的订单"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_012() {
		Logger.start(true, "代购神器直销商，带有买手优惠券，带有买手优惠，下单成功");
		try {
//			AgentProductBean productBean = DGSQBuildProxyChainCallService
//					.createProxychain((int) autotest_goodsOwnerId, 0, false);
//			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
//					BigDecimal.TEN, 20238699, productBean,
//					productBean.getSellerId(), true);

//			AgentProductBean productBean = DGSQBuildProxyChainCallService
//					.createComposeProductProxychain(
//							(int) 502381949, false, true);
//
//			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
//					BigDecimal.ZERO, 20238699, productBean,
//					productBean.getSellerId(), true);

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain(500041475, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.TEN, 502592844,
							productBean, productBean.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			// orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			// orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));
			orderItemVo2.setProductPrice(new BigDecimal("2000.00"));
			orderItemVo2.setProductNum(2);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(4991));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(productBean.getCatalogList().get(0),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_013() {
		Logger.start(true, "代理商一次下单一个商品,生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, (int) autotest_goodsOwnerId);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_014() {
		Logger.start(true, "代购神器直销商，下单时上调折扣，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, productBean.getSellerId());

			placeOrderReq.setDiscount(BigDecimal.TEN);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_015() {
		Logger.start(true, "代购神器渠道商，下单时下调折扣等于直销商利润，下单报错");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			OrderItemVo item = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			BigDecimal discount = item.getProductPrice()
					.multiply(new BigDecimal(item.getProductNum()))
					.add(item.getFreight());

			placeOrderReq.setDiscount(discount.negate());

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true, placeorderCall.getMsg()
					.contains("待分摊金额过大，无法按分摊比例及最大值限制分摊"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_016() {
		Logger.start(true, "代购神器，下单时传入proxyOrderId，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			placeOrderReq.setProxyOrderId(1234);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_017() {
		Logger.start(true, "渠道商一次下单一个商品，下单币种为CNY,生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 2, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);
			placeOrderReq.setCurrency("CNY");

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_018() {
		Logger.start(true, "渠道商一次下单一个商品，下单币种为外币,生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 2, false,
							true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);
			placeOrderReq.setCurrency(productBean.getCurrency());

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_019() {
		Logger.start(true, "外币币种类型不正确，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 2, false,
							true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);
			placeOrderReq.setCurrency("CHN");

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(201, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(198, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("currency is error"),
					"校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_020() {
		Logger.start(true, "一次下单多个商品,下单币种为外币，生产两个订单，同一个买手使用折扣下调");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false,
							true);
			String currency = productBean.getCurrency();

			int csId = SqTradingCallService.bindClientService(
					productBean.getSellerId(), 1);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(csId, BigDecimal.ZERO,
							20238699, productBean, autotest_goodsOwnerId);

			OrderVo orderVo = SqTradingCallService.createOrderVo(Lists
					.newArrayList(productBean));

			orderVo.getOrderItems().get(0)
					.setProductId(productBean.getProductId());
			orderVo.getOrderItems().get(0)
					.setCatalogId(productBean.getCatalogList().get(1));

			orderVo.setGoodsOwnerId(autotest_goodsOwnerId);
			orderVo.setShenqiLogisticsType(100);
			orderVo.setShenqiIdCardRequirement(0);

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);

			placeOrderReq.setDiscount(new BigDecimal("-10.00"));
			placeOrderReq.setCurrency(currency);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_021() {
		Logger.start(true, "代购神器渠道商，下单时下调折扣等于直销商利润，使用外币，下单报错");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false,
							true);
			String currency = productBean.getCurrency();

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			OrderItemVo item = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			BigDecimal discount = item.getProductPrice()
					.multiply(new BigDecimal(item.getProductNum()))
					.add(item.getFreight());

			placeOrderReq.setDiscount(discount.negate());
			placeOrderReq.setCurrency(currency);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(
					true,
					placeorderCall.getMsg().contains("待分摊金额过大，无法按分摊比例及最大值限制分摊"),
					"校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_022() {
		Logger.start(true, "一次下单多个商品,使用外币，生成一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false,
							true);
			String currency = productBean.getCurrency();
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			OrderItemVo orderItemVo = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo);

			placeOrderReq.setDiscount(new BigDecimal("10.00"));
			placeOrderReq.setCurrency(currency);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_023() {
		Logger.start(true, "一次下单多个商品,生产两个订单，一单为外币，另一单为CNY，同一个买手，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false,
							true);

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			String currency = productBean.getCurrency();
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			OrderVo orderVo = SqTradingCallService.createOrderVo(Lists
					.newArrayList(productBean1));

			orderVo.getOrderItems().get(0)
					.setProductId(productBean1.getProductId());
			orderVo.getOrderItems().get(0)
					.setCatalogId(productBean1.getCatalogList().get(1));

			orderVo.setGoodsOwnerId(autotest_goodsOwnerId);
			orderVo.setShenqiLogisticsType(100);
			orderVo.setShenqiIdCardRequirement(0);

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);
			placeOrderReq.setCurrency(currency);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(201, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(198, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(
					true,
					placeorderCall.getMsg().contains(
							"Failed to fetch proxy chain"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_024() {
		Logger.start(true, "一次下单多个商品,生产两个订单，外币为日币，商品的价格带有小数，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createJPProxychain(500058147, 1, false, true);

			String currency = productBean.getCurrency();
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, 500058147);
			placeOrderReq.setCurrency(currency);

			OrderVo orderVo = SqTradingCallService.createOrderVo(Lists
					.newArrayList(productBean));

			orderVo.getOrderItems().get(0)
					.setProductId(productBean.getProductId());
			orderVo.getOrderItems().get(0)
					.setProductPrice(new BigDecimal("433.11"));
			orderVo.getOrderItems().get(0)
					.setCatalogId(productBean.getCatalogList().get(1));

			orderVo.setGoodsOwnerId(500058147L);
			orderVo.setShenqiLogisticsType(100);
			orderVo.setShenqiIdCardRequirement(0);

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);
			placeOrderReq.setCurrency(currency);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals("商品运费或价格不能含有小数", placeorderCall.getMsg(),
					"校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_025() {
		Logger.start(true, "一次下单多个商品,生产两个订单，外币为日币，设置的折扣有小数，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createJPProxychain(500058147, 1, false, true);

			String currency = productBean.getCurrency();
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, 500058147);

			OrderVo orderVo = SqTradingCallService.createOrderVo(Lists
					.newArrayList(productBean));

			orderVo.getOrderItems().get(0)
					.setProductId(productBean.getProductId());
			orderVo.getOrderItems().get(0)
					.setCatalogId(productBean.getCatalogList().get(1));

			orderVo.setGoodsOwnerId(500058147L);
			orderVo.setShenqiLogisticsType(100);
			orderVo.setShenqiIdCardRequirement(0);

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);
			placeOrderReq.setCurrency(currency);
			placeOrderReq.setDiscount(new BigDecimal("10.01"));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals("调价金额不能含有小数", placeorderCall.getMsg(), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_026() {
		Logger.start(true, "一次下单多个商品,生产两个订单，外币为日币，下单成功，分摊的折扣金额不能有小数");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createJPProxychain(500058147, 1, false, true);

			String currency = productBean.getCurrency();
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, 500058147);

			// 创建一个新的order
			OrderVo orderVo = SqTradingCallService.createOrderVo(Lists
					.newArrayList(productBean));

			orderVo.getOrderItems().get(0)
					.setProductId(productBean.getProductId());
			orderVo.getOrderItems().get(0)
					.setProductPrice(new BigDecimal("1315"));
			orderVo.getOrderItems().get(0)
					.setCatalogId(productBean.getCatalogList().get(1));

			orderVo.setRegionDiscountRatio(new BigDecimal("8.50"));
			orderVo.setGoodsOwnerId(500058147L);
			orderVo.setShenqiLogisticsType(100);
			orderVo.setShenqiIdCardRequirement(0);

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);
			placeOrderReq.setCurrency(currency);
			placeOrderReq.setDiscount(new BigDecimal("10.00"));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_027() {
		Logger.start(true, "一次下单多个商品,生产一个订单，外币为日币，下单成功，分摊的折扣金额不能有小数");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createJPProxychain(500058147, 1, false, true);

			String currency = productBean.getCurrency();
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, 500058147);

			// 创建一个新的orderItem，并隶属于第一个订单
			OrderItemVo orderItem = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItem.setProductPrice(new BigDecimal("2000"));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItem);

			placeOrderReq.setCurrency(currency);
			placeOrderReq.setDiscount(new BigDecimal("10.00"));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_028() {
		Logger.start(true, "一次下单多个商品,使用韩币，生成一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createKRProxychain(500072235, 1, false);
			String currency = productBean.getCurrency();
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, 500072235);

			OrderItemVo orderItemVo = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo);

			placeOrderReq.setDiscount(new BigDecimal("10.00"));
			placeOrderReq.setCurrency(currency);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_029() {
		Logger.start(true, "渠道商一次下单一个商品,生产一个订单,带有税率和限购");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setProdTaxRate(new BigDecimal("0.125432"));
			orderItemVo.setBuyDailyLimit(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_030() {
		Logger.start(true, "一次下单多个商品,使用日币，生成一个订单, 每个商品都有税率和限购");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createJPProxychain(500058147, 0, false, true);
			String currency = productBean.getCurrency();
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, 500058147);

			placeOrderReq.getOrderGroups().get(0)
					.setServiceRate(new BigDecimal("0.16"));

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setProdTaxRate(new BigDecimal("0.067829"));
			orderItemVo.setBuyDailyLimit(false);

			OrderItemVo orderItemVo1 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			orderItemVo1.setProdTaxRate(new BigDecimal("0.124521"));
			orderItemVo1.setBuyDailyLimit(true);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo1);

			placeOrderReq.setCurrency(currency);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_031() {
		Logger.start(true, "渠道商一次下单多个商品,带有折扣，生产一个订单,带有税率和限购");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProdTaxRate(new BigDecimal("0.091"));
			orderItemVo1.setBuyDailyLimit(true);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			orderItemVo2.setProdTaxRate(new BigDecimal("0.23059"));
			orderItemVo2.setBuyDailyLimit(false);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeOrderReq.setDiscount(BigDecimal.TEN);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_032() {
		Logger.start(true, "渠道商一次下单多个商品,带有折扣，生成两个订单,带有税率和限购");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 2, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProdTaxRate(new BigDecimal("0.12"));
			orderItemVo1.setBuyDailyLimit(true);

			// 创建第二个商品
			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			orderItemVo2.setProdTaxRate(new BigDecimal("0.12"));
			orderItemVo2.setBuyDailyLimit(false);

			// 创建第二个订单
			OrderVo orderVo = SqTradingCallService.createOrderVo(Lists
					.newArrayList(productBean));

			orderItemVo2 = orderVo.getOrderItems().get(0);

			orderItemVo2.setCatalogId(productBean.getCatalogList().get(1));
			orderItemVo2.setProdTaxRate(new BigDecimal("0.10"));
			orderItemVo2.setBuyDailyLimit(false);

			orderVo.setGoodsOwnerId(autotest_goodsOwnerId);
			orderVo.setShenqiLogisticsType(999);
			orderVo.setShenqiIdCardRequirement(0);

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);

			placeOrderReq.setDiscount(BigDecimal.TEN.negate());

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_035() {
		Logger.start(true, "代购神器日本直销商，带有买手优惠券，带有买手优惠，下单成功");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createJPProxychain(500058147, 1, false, false);
			String currency = productBean.getCurrency();
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, productBean.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setProductPrice(new BigDecimal("1.00"));

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(productBean.getCatalogList().get(0),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);
			placeOrderReq.setCurrency(currency);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_036() {
		Logger.start(true, "代购神器继承代理，售价利润小于优惠金额，下单成功");
		try {
			Integer mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createInheritedProxychain((int) mchId, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, (int) mchId, true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setProductPrice(new BigDecimal(13));
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo1.setProductNum(1);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));
			orderItemVo2.setProductPrice(new BigDecimal(12));
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo2.setProductNum(1);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(productBean.getCatalogList().get(0),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_038() {
		Logger.start(true, "代购神器继承代理，使用订单折扣，下单失败");
		try {

			Integer mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createInheritedProxychain((int) mchId, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, new BigDecimal("1.00"),
							20238699, productBean, (int) mchId, false);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setProductPrice(new BigDecimal(13));
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo1.setProductNum(1);

			OrderVo orderVo2 = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean));

			OrderItemVo orderItemVo2 = orderVo2.getOrderItems().get(0);

			orderItemVo2.setCatalogId(productBean.getCatalogList().get(1));
			orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));
			orderItemVo2.setProductPrice(new BigDecimal(12));
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo2.setProductNum(1);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("您是分销小店无法改价，请联系渠道商！"),
					"校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_039() {
		Logger.start(true, "代购神器日本直销商，带有买手优惠券，支持线下支付，下单成功");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createJPProxychain(500058147, 1, false, true);
			String currency = productBean.getCurrency();
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, productBean.getSellerId(), true);

			placeOrderReq.setSupportOfflinePay(true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setProductPrice(new BigDecimal("1.00"));

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeOrderReq.setCurrency(currency);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_040() {
		Logger.start(true, "代购神器日本直销商，带有买手优惠券，不支持线下支付，下单成功");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createJPProxychain(500058147, 1, false, true);
			String currency = productBean.getCurrency();
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, productBean.getSellerId(), true);

			placeOrderReq.setSupportOfflinePay(false);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setProductPrice(new BigDecimal("1.00"));

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeOrderReq.setCurrency(currency);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_041() {
		Logger.start(true, "渠道商一次下单一个虚拟库存商品,生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 2, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			// 实际库存10 + 虚拟库存2
			orderItemVo.setProductNum(12);
			orderItemVo.setVirtualProductNum(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_042() {
		Logger.start(true, "直销商一次下单一个虚拟库存商品,生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			// 实际库存12 + 虚拟库存2
			orderItemVo.setProductNum(12);
			orderItemVo.setVirtualProductNum(2);

			orderItemVo.setProductPrice(BigDecimal.TEN);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_043() {
		Logger.start(true, "直销商一次下单一个虚拟库存商品,虚拟库存不足，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			// 实际库存130 + 虚拟库存30
			orderItemVo.setProductNum(131);
			orderItemVo.setVirtualProductNum(31);

			orderItemVo.setProductPrice(BigDecimal.TEN);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(201, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(108, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("商品库存不足|商品库存不足"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_DGSQPlaceOrder_044() {
		Logger.start(true, "虚拟库存商品下单,扣库存返回未知异常,下单失败,发送返库存消息");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			// 实际库存130 + 虚拟库存30
			orderItemVo.setProductNum(131);
			orderItemVo.setVirtualProductNum(31);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(201, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(105, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals("扣库存失败", placeorderCall.getMsg(), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

			MainOrderPo actualMainOrder = orderShardingWapper
					.selectMianOrderbyId(placeOrderReq.getMainOrderId());

			Logger.verifyEquals(
					ReduceProdStocksStatusEnum.SENT_RTN_MSG.getCode(),
					actualMainOrder.getStockStatus(), "验证数据库StockStatus");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_045() {
		Logger.start(true, "渠道商一次下单多个虚拟库存商品,生产多个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			// 实际库存10 + 虚拟库存2
			orderItemVo.setProductNum(12);
			orderItemVo.setVirtualProductNum(2);

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			// 第二个订单
			OrderVo orderVo = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean1));

			orderVo.getOrderItems().get(0).setProductNum(11);
			orderVo.getOrderItems().get(0).setVirtualProductNum(1);

			orderVo.setGoodsOwnerId(autotest_goodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_046() {
		Logger.start(true, "渠道商一次下单一个商品,生产一个神器代理购买订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 2, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.setShenqiProxyBuyOrder(true);
			placeOrderReq.setShenqiBuyOrderCsId(1235678L);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_047() {
		Logger.start(true, "一次下单多个商品,生成一个神器代理购买订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			OrderItemVo orderItemVo = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo);

			placeOrderReq.setDiscount(new BigDecimal("10.00"));
			placeOrderReq.setShenqiProxyBuyOrder(true);
			placeOrderReq.setShenqiBuyOrderCsId(1235678L);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_055() {
		Logger.start(true, "一次下单多个商品,代理商设置其中一个满减免运费，生产一个订单");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 2, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			orderItemVo2.setProductNum(1);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			orderItemVo.setFullReductionFreeFreight(true);
			orderItemVo.setProdTaxRate(new BigDecimal("0.17"));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}


	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_057() {
		Logger.start(true, "渠道商一次下单一个商品,自定义人民币结算，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 2, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);
			placeOrderReq.setCustomSettlementCurrencyType(1);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getErrorCodeValue(),
					"校验errorCodeValue");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("代理订单不能自定义结算账户"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_DGSQPlaceOrder_058() {
		Logger.start(true, "非开通双支付账户直销商一次下单一个商品,自定义外币结算，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, productBean.getSellerId());
			placeOrderReq.setCustomSettlementCurrencyType(1);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getErrorCodeValue(),
					"校验errorCodeValue");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("渠道商未开通双支付账户"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_059() {
		Logger.start(true, "开通双支付账户直销商一次下单一个商品,自定义外币结算，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain(500583265, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, 500583265);
			placeOrderReq.setCustomSettlementCurrencyType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_060() {
		Logger.start(true, "一次下单多个商品,生产两个个订单，使用别名");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setOrderAlias("order1");

			OrderVo orderVo = SqTradingCallService.createOrderVo(Lists
					.newArrayList(productBean));

			orderVo.getOrderItems().get(0)
					.setProductId(productBean.getProductId());
			orderVo.getOrderItems().get(0)
					.setCatalogId(productBean.getCatalogList().get(1));

			orderVo.setGoodsOwnerId(autotest_goodsOwnerId);
			orderVo.setShenqiLogisticsType(100);
			orderVo.setShenqiIdCardRequirement(0);
			orderVo.setOrderAlias("order2");

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_062() {
		Logger.start(true, "代购神器渠道商，带有买手优惠券，带有买手优惠，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 2, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId, true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));
			orderItemVo2.setFullReductionFreeFreight(true);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(productBean.getCatalogList().get(0),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setRegionDiscountRatio(new BigDecimal("7.00"));
			placeOrderReq.setDiscount(BigDecimal.TEN);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_063() {
		Logger.start(true, "代购神器渠道商，负利润，带有买手优惠券，带有买手优惠，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321L, BigDecimal.ZERO,
							20238699, productBean, autotest_goodsOwnerId, false);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			// orderItemVo1.setProductNum(1);
			// orderItemVo1.setProductPrice(BigDecimal.TEN);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));
			// orderItemVo2.setProductNum(1);
			// orderItemVo2.setProductPrice(BigDecimal.TEN);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			BigDecimal discount1 = orderItemVo1.getProductPrice().multiply(
					new BigDecimal(orderItemVo1.getProductNum()));

			BigDecimal discount2 = orderItemVo2.getProductPrice().multiply(
					new BigDecimal(orderItemVo2.getProductNum()));

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(discount1.add(discount2));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(productBean.getCatalogList().get(0),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_064() {
		Logger.start(true, "渠道商一次下单一个商品,payChannelType = 1, 境内商品，生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 2, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.setPayChannelType(1);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setDomesticProduct(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_065() {
		Logger.start(true,
				"渠道商一次下单一个商品,payChannelType = 2, 跨境订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0).setCrossBorderType(1);

			OrderItemVo orderItemVo = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo);

			placeOrderReq.setPayChannelType(2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_066() {
		Logger.start(true, "渠道商一次下单一个商品,带有自提信息，无需上传身份证生产一个订单，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.setAddressId(0);
			placeOrderReq.setAddress(null);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setShenqiIdCardRequirement(1);

			placeOrderReq.setPickupInStores(true);
			PickInStoreVo pickInStoreVo = new PickInStoreVo();

			pickInStoreVo.setPickupStoreId((long) TestDataManager
					.getRandomIntNum(6));
			pickInStoreVo.setPickupType(0);
			pickInStoreVo.setPickupUserName(TestDataManager.getChineseName());
			pickInStoreVo.setPickupUserPhone(TestDataManager.getPhoneNum());
			pickInStoreVo.setUserReserveTimeSpanStart(YMTDateUtil
					.getBeforeOrNextDate(0));
			pickInStoreVo.setUserReserveTimeSpanEnd(YMTDateUtil
					.getBeforeOrNextDate(10));

			placeOrderReq.setPickInStoreVo(pickInStoreVo);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("代理订单，不能上门自提"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_067() {
		Logger.start(true, "渠道商一次下单一个商品,带有自提信息，自提为false，需上传身份证，生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 2, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setShenqiIdCardRequirement(1);

			placeOrderReq.setPickupInStores(false);
			PickInStoreVo pickInStoreVo = new PickInStoreVo();

			pickInStoreVo.setPickupStoreId((long) TestDataManager
					.getRandomIntNum(6));
			pickInStoreVo.setPickupType(0);
			pickInStoreVo.setPickupUserName(TestDataManager.getChineseName());
			pickInStoreVo.setPickupUserPhone(TestDataManager.getPhoneNum());
			pickInStoreVo.setUserReserveTimeSpanStart(YMTDateUtil
					.getBeforeOrNextDate(0));
			pickInStoreVo.setUserReserveTimeSpanEnd(YMTDateUtil
					.getBeforeOrNextDate(10));

			placeOrderReq.setPickInStoreVo(pickInStoreVo);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_068() {
		Logger.start(true, "渠道商一次下单一个商品,下单输入PurchaserIdcardId，生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setPurchaserIdcardId(1234L);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setShenqiIdCardRequirement(1);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_069() {
		Logger.start(true, "代购神器渠道商，下单时单个商品，0利润，向下调价，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			OrderItemVo item = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			item.setProductPrice(new BigDecimal(productBean
					.getAgentCatalogPriceList().get(0).getDirectPrice())
					.add(BigDecimal.ONE));
			item.setProductNum(1);
			item.setFreight(BigDecimal.ZERO);

			BigDecimal discount = BigDecimal.ONE.negate();

			placeOrderReq.setDiscount(discount);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_070() {
		Logger.start(true, "代购神器渠道商，下单时多个商品，0利润，向上调价，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			OrderVo orderVo = placeOrderReq.getOrderGroups().get(0).getOrders()
					.get(0);

			// 第一个商品利润设置为0
			OrderItemVo item = orderVo.getOrderItems().get(0);
			item.setProductPrice(new BigDecimal(productBean
					.getAgentCatalogPriceList().get(0).getDirectPrice()));

			// 添加第二个商品
			orderVo.getOrderItems().add(
					SqTradingCallService.createOrderItemVo(productBean
							.getProductId(), productBean.getCatalogList()
							.get(1)));

			// 第二个商品利润设置为0
			orderVo.getOrderItems()
					.get(1)
					.setProductPrice(
							new BigDecimal(productBean
									.getAgentCatalogPriceList().get(1)
									.getDirectPrice()));

			BigDecimal discount = BigDecimal.ONE;

			placeOrderReq.setDiscount(discount);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_071() {
		Logger.start(true, "代购神器渠道商，下单时多个商品，其中一个商品0利润，向上调价，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			OrderVo orderVo = placeOrderReq.getOrderGroups().get(0).getOrders()
					.get(0);

			// 第一个商品利润设置为0
			OrderItemVo item = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			item.setProductPrice(new BigDecimal(productBean
					.getAgentCatalogPriceList().get(0).getDirectPrice()));

			// 添加第二个商品
			orderVo.getOrderItems().add(
					SqTradingCallService.createOrderItemVo(productBean
							.getProductId(), productBean.getCatalogList()
							.get(1)));

			BigDecimal discount = BigDecimal.ONE;

			placeOrderReq.setDiscount(discount);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_072() {
		Logger.start(true, "代购神器渠道商，下单时多个订单，其中一个订单0利润，向上调价，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			// 第一个商品利润设置为0
			OrderItemVo item = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			item.setProductPrice(new BigDecimal(productBean
					.getAgentCatalogPriceList().get(0).getDirectPrice()));

			// 创建第二个订单
			OrderVo orderVo = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean));

			orderVo.getOrderItems().remove(0);

			// 添加商品
			orderVo.getOrderItems().add(
					SqTradingCallService.createOrderItemVo(productBean
							.getProductId(), productBean.getCatalogList()
							.get(1)));

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);

			BigDecimal discount = BigDecimal.ONE;

			placeOrderReq.setDiscount(discount);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_073() {
		Logger.start(true, "渠道商一次下单一个商品,带有WarehouseId，生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 2, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setWarehouseId(214123);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_075() {
		Logger.start(true, "渠道商一次下单一个商品,如果地址开头为香港，则免税费，生产一个订单");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 2, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.setAddress("海外" + TestDataManager.randomStr(5));
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0)
					.setProdTaxRate(new BigDecimal("0.17"));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_076() {
		Logger.start(true, "分销小店一次下单一个商品，生产一个订单");
		try {

			Integer mchId = DGSQBaseService.createIndependenceMch("USA");
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createRetailShopProxychain(mchId, BigDecimal.TEN, false);

			DGSQBaseService.editRetailShopProductRebate(
					productBean.getProductId(), productBean.getSellerId(),
					(long) mchId, new BigDecimal("15.00"));

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, mchId);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_078() {
		Logger.start(true, "分销小店一次下单一个商品，多级代理，生产一个订单");
		try {

			Integer mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createIndependenceProxychain(mchId, 1, true, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, mchId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setFullReductionFreeFreight(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_080() {
		Logger.start(true, "渠道商一次下单一个商品，带有积分会员信息,生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.setEntryIdType(1);
			placeOrderReq.setEntryIdNo(TestDataManager.randomStr(8));
			placeOrderReq.setEntryTime(YMTDateUtil.getBeforeOrNextDate(
					YMTDateUtil.getDate(), 1));
			placeOrderReq.setEntryPort("entryPPPPPentryPPPPPentryPPPPPentryPPPPPentryPPPPPentryPPPPPentryPPPPPentry" +
                    "PPPPPentryPPPPPentryPPPPP1234567");
			placeOrderReq.setTransportation("autotest_flight");

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_081() {
		Logger.start(true, "渠道商一次下单一个虚拟库存商品，一个没有虚拟库存商品,生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			// 实际库存12 + 虚拟库存2
			orderItemVo.setProductNum(12);
			orderItemVo.setVirtualProductNum(2);

			orderItemVo.setProductPrice(BigDecimal.TEN);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			orderItemVo2.setProductNum(2);

			orderItemVo2.setProductPrice(BigDecimal.TEN);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_082() {
		Logger.start(true, "分销小店一次下单多个商品，多级代理，带买手优惠券、买手优惠和满减优惠，生产一个订单");
		try {

			Integer mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createIndependenceProxychain(mchId, 2, true, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, mchId, true, false);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setFullReductionFreeFreight(true);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(productBean.getCatalogList().get(0),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_083() {
		Logger.start(true, "直销商一次下单一个商品,设置服务费率，生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.getOrderGroups().get(0)
					.setServiceRate(new BigDecimal("13.00"));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_084() {
		Logger.start(true, "直销商一次下单多个商品,带有各种优惠和税率，设置服务费率，生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.TEN,
							20238699, productBean, autotest_goodsOwnerId, true,
							false);

			OrderGroupVo orderGroupVo = placeOrderReq.getOrderGroups().get(0);

			OrderItemVo orderItemVo1 = orderGroupVo.getOrders().get(0)
					.getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setFullReductionFreeFreight(true);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(productBean.getCatalogList().get(0),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			orderGroupVo.setSellerPromotionApportions(sellerPromotionList);
			orderGroupVo.setServiceRate(new BigDecimal("12.00"));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_085() {
		Logger.start(true, "代理商一次下单一个商品,设置服务费率，生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.getOrderGroups().get(0)
					.setServiceRate(new BigDecimal("13.00"));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_086() {
		Logger.start(true, "校验折扣分摊是否使用apportionByWeightsAndMaxLimit，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0)
					.setProductPrice(new BigDecimal("0.01"));
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setFreight(BigDecimal.ZERO);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setProductNum(1);

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			OrderVo orderVo = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean1));

			orderVo.getOrderItems().get(0).setProductNum(2);
			orderVo.getOrderItems().get(0)
					.setProductPrice(new BigDecimal("49.00"));

			OrderItemVo orderItemVo = SqTradingCallService
					.createOrderItemVo(productBean1.getProductId(),
							productBean1.getCatalogList().get(1));

			orderItemVo.setProductNum(3);
			orderItemVo.setProductPrice(new BigDecimal("29.99"));

			orderVo.getOrderItems().add(orderItemVo);

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);

			placeOrderReq.setDiscount(new BigDecimal("93.99").negate());

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_087() {
		Logger.start(true, "渠道商一次下单一个旅游出行人，生产一个订单");
		try {
			 AgentProductBean productBean = DGSQBuildProxyChainCallService
					 .createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			TravelerVo travelerVo = new TravelerVo();

			travelerVo.setTravelerPhone(TestDataManager.getPhoneNum());
			travelerVo.setTravelerName("autotest"
					+ TestDataManager.getChineseName());
			travelerVo.setTravelerIdcard(TestDataManager.getCardId(20, 1));
			travelerVo.setTravelerDate(YMTDateUtil.getDate());
			travelerVo.setRemark("remark" + TestDataManager.randomStr(20));

			placeOrderReq.setTravelerVos(Arrays.asList(travelerVo));
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setFirstCategoryId(2657);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_088() {
		Logger.start(true, "渠道商一次下单多个旅游出行人，生成多个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.setAddressId(0);
			placeOrderReq.setAddress(null);

			TravelerVo travelerVo1 = new TravelerVo();

			travelerVo1.setTravelerPhone(TestDataManager.getPhoneNum());
			travelerVo1.setTravelerName("autotest"
					+ TestDataManager.getChineseName());
			travelerVo1.setTravelerIdcard(TestDataManager.getCardId(20, 1));
			travelerVo1.setTravelerDate(YMTDateUtil.getDate());
			travelerVo1.setRemark("remark" + TestDataManager.randomStr(20));

			TravelerVo travelerVo2 = new TravelerVo();

			travelerVo2.setTravelerPhone(TestDataManager.getPhoneNum());
			travelerVo2.setTravelerName("autotest"
					+ TestDataManager.getChineseName());
			travelerVo2.setTravelerIdcard(TestDataManager.getCardId(20, 1));
			travelerVo2.setTravelerDate(YMTDateUtil.getDate());
			travelerVo2.setRemark("remark" + TestDataManager.randomStr(20));

			TravelerVo travelerVo3 = new TravelerVo();

			travelerVo3.setTravelerName("autotest"
					+ TestDataManager.getChineseName());
			travelerVo3.setTravelerIdcard(TestDataManager.getCardId(20, 1));

			placeOrderReq.setTravelerVos(Arrays.asList(travelerVo1,
					travelerVo2, travelerVo3));

			productBean = DGSQBuildProxyChainCallService.createProxychain(
					(int) autotest_goodsOwnerId, 0, false);
			OrderVo orderVo = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean));

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setFirstCategoryId(2657);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_089() {
		Logger.start(true, "渠道商一次下单一个旅游出行人，主出行人没有名称");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			TravelerVo travelerVo = new TravelerVo();

			travelerVo.setTravelerPhone(TestDataManager.getPhoneNum());
			// travelerVo.setTravelerName("autotest" +
			// TestDataManager.getChineseName());
			travelerVo.setTravelerIdcard(TestDataManager.getCardId(20, 1));
			travelerVo.setTravelerDate(YMTDateUtil.getDate());
			travelerVo.setRemark("remark" + TestDataManager.randomStr(20));

			placeOrderReq.setTravelerVos(Arrays.asList(travelerVo));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(
					true,
					placeorderCall.getMsg().contains(
							"travelerName:must not be null"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_090() {
		Logger.start(true, "渠道商一次下单一个旅游出行人，主出行人没有手机号");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			TravelerVo travelerVo = new TravelerVo();

			// travelerVo.setTravelerPhone(TestDataManager.getPhoneNum());
			travelerVo.setTravelerName("autotest"
					+ TestDataManager.getChineseName());
			travelerVo.setTravelerIdcard(TestDataManager.getCardId(20, 1));
			travelerVo.setTravelerDate(YMTDateUtil.getDate());
			travelerVo.setRemark("remark" + TestDataManager.randomStr(20));

			placeOrderReq.setTravelerVos(Arrays.asList(travelerVo));
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setFirstCategoryId(2657);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_091() {
		Logger.start(true, "渠道商一次下单多个旅游出行人，副出行人没有名称");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			TravelerVo travelerVo = new TravelerVo();

			travelerVo.setTravelerPhone(TestDataManager.getPhoneNum());
			travelerVo.setTravelerName("autotest"
					+ TestDataManager.getChineseName());
			travelerVo.setTravelerIdcard(TestDataManager.getCardId(20, 1));
			travelerVo.setTravelerDate(YMTDateUtil.getDate());
			travelerVo.setRemark("remark" + TestDataManager.randomStr(20));

			TravelerVo travelerVo2 = new TravelerVo();

			placeOrderReq
					.setTravelerVos(Arrays.asList(travelerVo, travelerVo2));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(
					true,
					placeorderCall.getMsg().contains(
							"travelerName:must not be null"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_093() {
		Logger.start(true, "渠道商一次下单一个自动接单,生产一个订单");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			Integer activityId = SqTradingProductService
					.agentProductAddActivity(productBean, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			ActivityVo activityVo = new ActivityVo();

			activityVo.setActivityId(activityId);
			activityVo.setActivityTemplateId(5123);
			activityVo.setAfterActivityFinishAccept(true);
			activityVo.setProductInActivityId(1234);

			orderItemVo.setActivity(activityVo);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_094() {
		Logger.start(true, "渠道商一次下单一个自动接单活动商品，另一个普通商品,生产一个订单");
		try {

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			Integer activityId = SqTradingProductService
					.agentProductAddActivity(productBean1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean1, (int) autotest_goodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			ActivityVo activityVo = new ActivityVo();

			activityVo.setActivityId(activityId);
			activityVo.setActivityTemplateId(5123);
			activityVo.setAfterActivityFinishAccept(true);
			activityVo.setProductInActivityId(1234);

			orderItemVo.setActivity(activityVo);

			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq
					.getOrderGroups()
					.get(0)
					.getOrders()
					.get(0)
					.getOrderItems()
					.add(SqTradingCallService.createOrderItemVo(
							productBean2.getProductId(), productBean2
									.getCatalogList().get(0)));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_096() {
		Logger.start(true, "直销商下单组合商品，一次下单一个商品,生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) autotest_goodsOwnerId, false, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setSubProduct(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_097() {
		Logger.start(true, "直销商下单组合商品，一次下单多个套装商品，带有各种优惠、折扣和税费，生产一个订单");
		try {
			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) autotest_goodsOwnerId, false, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean1, productBean1.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSubProduct(true);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));

			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) autotest_goodsOwnerId, false, false);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean2.getRootProductId(),
							productBean2.getCatalogList().get(0));

			orderItemVo2.setSubProduct(true);
			orderItemVo2.setProdTaxRate(new BigDecimal("0.12"));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(orderItemVo1.getCatalogId(),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);
			placeOrderReq.setDiscount(BigDecimal.TEN);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_098() {
		Logger.start(true, "直销商下单组合商品，一次下单多个商品，一个普通商品，一个套装商品，生产一个订单");
		try {
			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) autotest_goodsOwnerId, false, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean1, productBean1.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSubProduct(false);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));

			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) autotest_goodsOwnerId, false, false);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean2.getRootProductId(),
							productBean2.getCatalogList().get(0));

			orderItemVo2.setSubProduct(true);
			orderItemVo2.setProdTaxRate(new BigDecimal("0.12"));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeOrderReq.setDiscount(BigDecimal.TEN.negate());

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_099() {
		Logger.start(true, "直销商下单组合商品，一次下单多个套装商品，日币支付，生产一个订单");
		try {
			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createComposeProductProxychain((int) 500058147, false,
							false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean1, productBean1.getSellerId(), false);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSubProduct(true);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));

			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) autotest_goodsOwnerId, false, false);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean2.getRootProductId(),
							productBean2.getCatalogList().get(0));

			orderItemVo2.setSubProduct(true);
			orderItemVo2.setProdTaxRate(new BigDecimal("0.12"));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeOrderReq.setDiscount(BigDecimal.TEN);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_100() {
		Logger.start(true, "代理商下单组合商品，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setSubProduct(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("代理订单不能包含组合商品"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_DGSQPlaceOrder_101() {
		Logger.start(true, "yabandGoodsOwnerId下单，不被风控，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) yabandGoodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) yabandGoodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setProductPrice(new BigDecimal("20000"));
			orderItemVo.setProductNum(3);

			orderItemVo.setFreight(BigDecimal.ZERO);

			placeOrderReq.setPayChannelType(3);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	// yaband商户无法创建代理代理
	public void Tc_DGSQPlaceOrder_102() {
		Logger.start(true, "yabandGoodsOwnerId下单，代理商下单，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) yabandGoodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) yabandGoodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setProductPrice(new BigDecimal("20000"));
			orderItemVo.setProductNum(3);

			orderItemVo.setFreight(BigDecimal.ZERO);

			placeOrderReq.setPayChannelType(3);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("该商户使用Yaband支付，无法下代理订单"),
					"校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_103() {
		Logger.start(true, "yaband下单，结算币种非欧元，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setSubProduct(true);
			placeOrderReq.setPayChannelType(3);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(
					true,
					placeorderCall.getMsg().contains(
							"该商户使用Yaband支付，商户结算币种必须是欧元"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_DGSQPlaceOrder_104() {
		Logger.start(true, "连锁店下单，不被风控，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) chainStoreGoodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) chainStoreGoodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setProductPrice(new BigDecimal("20000"));
			orderItemVo.setProductNum(3);

			orderItemVo.setFreight(BigDecimal.ZERO);

			placeOrderReq.setPayChannelType(4);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_DGSQPlaceOrder_105() {
		Logger.start(true, "连锁店下单，代理商下单，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setProductPrice(new BigDecimal("20000"));
			orderItemVo.setProductNum(3);

			orderItemVo.setFreight(BigDecimal.ZERO);

			placeOrderReq.setPayChannelType(4);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("该商户使用微信直连支付，无法下代理订单"),
					"校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	@Ignore
	public void Tc_DGSQPlaceOrder_106() {
		Logger.start(true, "连锁店下单，标价币种币种非人民币，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) chainStoreGoodsOwnerId, 0, false,
							true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) chainStoreGoodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setSubProduct(true);
			placeOrderReq.setPayChannelType(4);
			placeOrderReq.setCurrency(productBean.getCurrency());

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("微信直连商品标价必须是RMB"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_107() {
		Logger.start(true, "代购神器直销订单，商品信息带有成本价");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setPrimeCostPrice(BigDecimal.TEN);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			orderItemVo2.setPrimeCostPrice(new BigDecimal("42.12"));
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_108() {
		Logger.start(true, "代购神器代理下单，商品信息带有成本价");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}


	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_116() {
		Logger.start(true, "代理商一次下单一个商品，使用10积分，生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, true);

			Long shopId = productBean.getSellerId();

			GodPointsService.saveCreditPolicyReq(shopId);
			Thread.sleep(500);

			GodPointsService.sendCredit(shopId, 20238699L);
			Thread.sleep(500);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.setIntegral(10L);

			placeOrderReq.setShenqiProxyBuyOrder(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_117() {
		Logger.start(true, "直销商一次下单一个商品，使用10积分，生产一个订单");
		try {

			int mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) mchId, 0, false);

			GodPointsService.saveCreditPolicyReq((long) mchId);
			Thread.sleep(500);

			GodPointsService.sendCredit((long) mchId, 20238699L);
			Thread.sleep(500);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) mchId);

			placeOrderReq.setIntegral(10L);
			placeOrderReq.setIntegralServiceType(1);
			placeOrderReq.setShenqiProxyBuyOrder(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_118() {
		Logger.start(true, "直销商一次下单一个商品，使用10积分并且使用折扣，下单成功");
		try {
			int mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) mchId, 0, false);

			GodPointsService.saveCreditPolicyReq((long) mchId);
			Thread.sleep(500);

			GodPointsService.sendCredit((long) mchId, 20238699L);
			Thread.sleep(500);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) mchId);

			placeOrderReq.setIntegral(10L);
			placeOrderReq.setIntegralServiceType(1);
			placeOrderReq.setDiscount(BigDecimal.ONE);
			placeOrderReq.setShenqiProxyBuyOrder(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_119() {
		Logger.start(true, "代购神器直销商，带有买手优惠券，带有买手优惠，使用积分，下单成功");
		try {
			int mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) mchId, 0, false);

			GodPointsService.saveCreditPolicyReq((long) mchId);
			Thread.sleep(500);

			GodPointsService.sendCredit((long) mchId, 20238699L);
			Thread.sleep(500);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.TEN, 20238699,
							productBean, productBean.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			placeOrderReq.getOrderGroups().get(0)
					.setServiceRate(new BigDecimal("13.00"));

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));
			orderItemVo2.setProductNum(2);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(productBean.getCatalogList().get(0),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeOrderReq.setIntegral(10L);
			placeOrderReq.setIntegralServiceType(1);
			placeOrderReq.setShenqiProxyBuyOrder(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_120() {
		Logger.start(true, "代购神器渠道商，带有买手优惠券，带有买手优惠，使用积分，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			Long shopId = productBean.getSellerId();

			GodPointsService.saveCreditPolicyReq((long) shopId);
			Thread.sleep(500);

			GodPointsService.sendCredit((long) shopId, 20238699L);
			Thread.sleep(500);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId, true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setFullReductionFreeFreight(true);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));
			orderItemVo2.setFullReductionFreeFreight(true);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(productBean.getCatalogList().get(0),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeOrderReq.setIntegral(10L);
			placeOrderReq.setIntegralServiceType(1);
			placeOrderReq.setShenqiProxyBuyOrder(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_121() {
		Logger.start(true, "直销商一次下单一个商品，积分使用超过90%限额，下单失败");
		try {
			int mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) mchId, 0, false);

			CreditPolicy creditPolicy_ORDER_DEDUCT = new CreditPolicy();

			creditPolicy_ORDER_DEDUCT.setAmount(BigDecimal.ONE);
			creditPolicy_ORDER_DEDUCT.setBizType(PointsBizTypeEnum.ORDER_DEDUCT
					.getCode());
			creditPolicy_ORDER_DEDUCT.setCredit(1);
			creditPolicy_ORDER_DEDUCT.setCurrency("CNY");

			GodPointsService.saveCreditPolicyReqWithORDER_DEDUCT((long) mchId,
					creditPolicy_ORDER_DEDUCT);
			Thread.sleep(500);

			GodPointsService.sendCredit((long) mchId, 20238699L);
			Thread.sleep(500);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, mchId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setFullReductionFreeFreight(true);
			orderItemVo.setProductNum(1);

			long maxIntegral = orderItemVo.getProductPrice()
					.multiply(new BigDecimal("0.9"))
					.setScale(0, BigDecimal.ROUND_DOWN).longValue();

			placeOrderReq.setIntegral(maxIntegral + 1);
			placeOrderReq.setIntegralServiceType(1);
			placeOrderReq.setShenqiProxyBuyOrder(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("下单使用积分大于最大可用积分"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_122() {
		Logger.start(true, "直销商一次下单一个商品，未达到积分使用门槛，使用积分，下单失败");
		try {
			int mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) mchId, 0, false);

			CreditPolicy creditPolicy_SHARE_SEND = new CreditPolicy();

			creditPolicy_SHARE_SEND.setAmount(BigDecimal.TEN);
			creditPolicy_SHARE_SEND.setBizType(PointsBizTypeEnum.SHARE_SEND
					.getCode());
			creditPolicy_SHARE_SEND.setCredit(1);
			creditPolicy_SHARE_SEND.setCurrency("");

			GodPointsService.saveCreditPolicyReqWithSHARE_SEND((long) mchId,
					creditPolicy_SHARE_SEND);
			Thread.sleep(500);

			GodPointsService.sendCredit((long) mchId, 20238699L);
			Thread.sleep(500);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) mchId);

			placeOrderReq.setIntegral(1L);
			placeOrderReq.setIntegralServiceType(1);
			placeOrderReq.setDiscount(BigDecimal.ONE);
			placeOrderReq.setShenqiProxyBuyOrder(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("积分余额少于可使用门槛"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_123() {
		Logger.start(true, "代购神器渠道商，下单时多个商品，0利润，使用积分，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			Long shopId = productBean.getSellerId();

			GodPointsService.saveCreditPolicyReq((long) shopId);
			Thread.sleep(500);

			GodPointsService.sendCredit((long) shopId, 20238699L);
			Thread.sleep(500);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			OrderVo orderVo = placeOrderReq.getOrderGroups().get(0).getOrders()
					.get(0);

			// 第一个商品利润设置为0
			OrderItemVo item = orderVo.getOrderItems().get(0);
			item.setProductPrice(new BigDecimal(productBean
					.getAgentCatalogPriceList().get(0).getDirectPrice()));
			item.setFullReductionFreeFreight(true);

			// 添加第二个商品
			orderVo.getOrderItems().add(
					SqTradingCallService.createOrderItemVo(productBean
							.getProductId(), productBean.getCatalogList()
							.get(1)));

			// 第二个商品利润设置为0
			orderVo.getOrderItems()
					.get(1)
					.setProductPrice(new BigDecimal("900.00"));
			orderVo.getOrderItems()
					.get(1)
					.setFullReductionFreeFreight(true);

			placeOrderReq.setIntegral(10L);
			placeOrderReq.setIntegralServiceType(1);
			placeOrderReq.setShenqiProxyBuyOrder(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("下单使用积分大于最大可用积分"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_124() {
		Logger.start(true, "分销小店多级代理，一次下单一个商品，使用积分，生产一个订单");
		try {

			Integer mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createIndependenceProxychain(mchId, 2, true, false);

			Long shopId = productBean.getSellerId();

			GodPointsService.saveCreditPolicyReq((long) shopId);
			Thread.sleep(500);

			GodPointsService.sendCredit((long) shopId, 20238699L);
			Thread.sleep(500);

			DGSQBaseService.editRetailShopProductRebate(
					productBean.getProductId(), shopId, (long) mchId,
					new BigDecimal("15.00"));

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, mchId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setFullReductionFreeFreight(true);

			placeOrderReq.setIntegral(10L);
			placeOrderReq.setIntegralServiceType(1);
			placeOrderReq.setShenqiProxyBuyOrder(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_125() {
		Logger.start(true, "分销小店一次下单多个商品，带买手优惠券和买手优惠，使用积分，生产一个订单");
		try {

			Integer mchId = DGSQBaseService.createIndependenceMch("USA");
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createRetailShopProxychain(mchId, BigDecimal.TEN, false);

			Long shopId = productBean.getSellerId();

			GodPointsService.saveCreditPolicyReq((long) shopId);
			Thread.sleep(500);

			GodPointsService.sendCredit((long) shopId, 20238699L);
			Thread.sleep(500);

			DGSQBaseService.editRetailShopProductRebate(
					productBean.getProductId(), shopId, (long) mchId,
					new BigDecimal("15.00"));

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, mchId, true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setFullReductionFreeFreight(true);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(productBean.getCatalogList().get(0),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);


			placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).setRegionDiscountRatio(new BigDecimal("7.00"));

			placeOrderReq.setIntegral(20L);
			placeOrderReq.setIntegralServiceType(1);
			placeOrderReq.setShenqiProxyBuyOrder(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_126() {
		Logger.start(true, "商户没有配置积分，下单使用积分报错");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.setIntegral(10L);
			placeOrderReq.setIntegralServiceType(1);
			placeOrderReq.setShenqiProxyBuyOrder(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true, placeorderCall.getMsg()
					.contains("不可使用积分"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_127() {
		Logger.start(true, "商户已配置积分策略，买家没有积分，下单使用积分报错");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, true);

			GodPointsService.saveCreditPolicyReq(productBean.getSellerId());

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.setIntegral(10L);
			placeOrderReq.setIntegralServiceType(1);
			placeOrderReq.setShenqiProxyBuyOrder(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("积分余额少于可使用门槛"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_128() {
		Logger.start(true, "商户已配置积分策略，买家端购买，下单使用积分报错");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, true);

			GodPointsService.saveCreditPolicyReq(productBean.getSellerId());

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.setIntegral(10L);
			placeOrderReq.setIntegralServiceType(1);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true, placeorderCall.getMsg()
					.contains("不可使用积分"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_129() {
		Logger.start(true, "代理商一次下单一个商品，积分使用超过店主利润，90%限额，下单失败");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, true);

			Long shopId = productBean.getSellerId();

			CreditPolicy creditPolicy_ORDER_DEDUCT = new CreditPolicy();

			creditPolicy_ORDER_DEDUCT.setAmount(BigDecimal.ONE);
			creditPolicy_ORDER_DEDUCT.setBizType(PointsBizTypeEnum.ORDER_DEDUCT
					.getCode());
			creditPolicy_ORDER_DEDUCT.setCredit(1);
			creditPolicy_ORDER_DEDUCT.setCurrency("CNY");

			GodPointsService.saveCreditPolicyReqWithORDER_DEDUCT(shopId,
					creditPolicy_ORDER_DEDUCT);
			Thread.sleep(500);

			GodPointsService.sendCredit(shopId, 20238699L);
			Thread.sleep(500);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, autotest_goodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setFullReductionFreeFreight(true);
			orderItemVo.setProductNum(1);

			long maxIntegral = orderItemVo.getProductPrice()
					.multiply(new BigDecimal("0.9"))
					.setScale(0, BigDecimal.ROUND_DOWN).longValue();

			placeOrderReq.setIntegral(maxIntegral + 1);
			placeOrderReq.setIntegralServiceType(1);
			placeOrderReq.setShenqiProxyBuyOrder(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("下单使用积分大于最大可用积分"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_130() {
		Logger.start(true, "直销商下单组合商品，一次下单多个套装商品，带有各种优惠、折扣和税费，使用积分，生产一个订单");
		try {

			Integer mchId = DGSQBaseService.createIndependenceMch("USA");
			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createComposeProductProxychain((int) mchId, false, false);

			Long shopId1 = productBean1.getSellerId();

			GodPointsService.saveCreditPolicyReq((long) shopId1);
			Thread.sleep(500);

			GodPointsService.sendCredit((long) shopId1, 20238699L);
			Thread.sleep(500);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean1, productBean1.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setSubProduct(true);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));

			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createComposeProductProxychain((int) mchId, false, false);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean2.getRootProductId(),
							productBean2.getCatalogList().get(0));

			orderItemVo2.setSubProduct(true);
			orderItemVo2.setProdTaxRate(new BigDecimal("0.12"));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(orderItemVo1.getCatalogId(),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);
			placeOrderReq.setDiscount(BigDecimal.TEN);
			placeOrderReq.setShenqiProxyBuyOrder(true);

			placeOrderReq.setIntegral(10L);
			placeOrderReq.setIntegralServiceType(1);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_131() {
		Logger.start(true, "直销商一次下单多个商品，1积分抵扣1元，下单成功");
		try {
			int mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) mchId, 0, false);

			CreditPolicy creditPolicy_ORDER_DEDUCT = new CreditPolicy();

			creditPolicy_ORDER_DEDUCT.setAmount(BigDecimal.ONE);
			creditPolicy_ORDER_DEDUCT.setBizType(PointsBizTypeEnum.ORDER_DEDUCT
					.getCode());
			creditPolicy_ORDER_DEDUCT.setCredit(1);
			creditPolicy_ORDER_DEDUCT.setCurrency("CNY");

			GodPointsService.saveCreditPolicyReqWithORDER_DEDUCT((long) mchId,
					creditPolicy_ORDER_DEDUCT);
			Thread.sleep(500);

			GodPointsService.sendCredit((long) mchId, 20238699L);
			Thread.sleep(500);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, mchId);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeOrderReq.setIntegral(1L);
			placeOrderReq.setShenqiProxyBuyOrder(true);
			placeOrderReq.setIntegralServiceType(1);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_132() {
		Logger.start(true, "代购神器渠道商，下单时多个商品，某个商品负利润，使用积分，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			Long shopId = productBean.getSellerId();

			GodPointsService.saveCreditPolicyReq((long) shopId);
			Thread.sleep(500);

			GodPointsService.sendCredit((long) shopId, 20238699L);
			Thread.sleep(500);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			OrderVo orderVo = placeOrderReq.getOrderGroups().get(0).getOrders()
					.get(0);

			// 添加第二个商品
			orderVo.getOrderItems().add(
					SqTradingCallService.createOrderItemVo(productBean
							.getProductId(), productBean.getCatalogList()
							.get(1)));

			// 第二个商品利润设置为0
			orderVo.getOrderItems()
					.get(1)
					.setProductPrice(
							new BigDecimal(productBean
									.getAgentCatalogPriceList().get(1)
									.getDirectPrice()));

			orderVo.getOrderItems().get(1).setFreight(BigDecimal.ZERO);

			placeOrderReq.setIntegral(10L);
			placeOrderReq.setShenqiProxyBuyOrder(true);
			placeOrderReq.setIntegralServiceType(1);

			placeOrderReq.setDiscount(BigDecimal.TEN.negate());

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_133() {
		Logger.start(true, "代购神器渠道商，多个订单，使用积分，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			Long shopId = productBean.getSellerId();

			GodPointsService.saveCreditPolicyReq((long) shopId);
			Thread.sleep(500);

			GodPointsService.sendCredit((long) shopId, 20238699L);
			Thread.sleep(500);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId, false);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));

			// 创建第二个订单
			OrderVo orderVo = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean));

			orderVo.getOrderItems().remove(0);

			// 添加商品
			orderVo.getOrderItems().add(
					SqTradingCallService.createOrderItemVo(productBean
							.getProductId(), productBean.getCatalogList()
							.get(1)));

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);

			placeOrderReq.setIntegral(10L);
			placeOrderReq.setShenqiProxyBuyOrder(true);
			placeOrderReq.setIntegralServiceType(1);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	// 主分支扣积分问题
	public void Tc_DGSQPlaceOrder_134() {
		Logger.start(true, "代购神器渠道商，多个订单，使用积分，其中一个订单0利润，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			Long shopId = productBean.getSellerId();

			GodPointsService.saveCreditPolicyReq((long) shopId);
			Thread.sleep(500);

			GodPointsService.sendCredit((long) shopId, 20238699L);
			Thread.sleep(500);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId, false);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo1.setProductPrice(new BigDecimal(productBean
					.getAgentCatalogPriceList().get(0).getDirectPrice()));

			// 创建第二个订单
			OrderVo orderVo = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean));

			orderVo.getOrderItems().remove(0);

			// 添加商品
			orderVo.getOrderItems().add(
					SqTradingCallService.createOrderItemVo(productBean
							.getProductId(), productBean.getCatalogList()
							.get(1)));

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);

			placeOrderReq.setIntegral(10L);
			placeOrderReq.setShenqiProxyBuyOrder(true);
			placeOrderReq.setIntegralServiceType(1);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(201, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(105, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("扣积分失败"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_135() {
		Logger.start(true, "代购神器渠道商，下单时多个商品，100积分兑换1元钱，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			Long shopId = productBean.getSellerId();

			CreditPolicy creditPolicy_ORDER_DEDUCT = new CreditPolicy();

			creditPolicy_ORDER_DEDUCT.setAmount(new BigDecimal("0.01"));
			creditPolicy_ORDER_DEDUCT.setBizType(PointsBizTypeEnum.ORDER_DEDUCT
					.getCode());
			creditPolicy_ORDER_DEDUCT.setCredit(100);
			creditPolicy_ORDER_DEDUCT.setCurrency("CNY");

			GodPointsService.saveCreditPolicyReqWithORDER_DEDUCT(shopId,
					creditPolicy_ORDER_DEDUCT);
			Thread.sleep(500);

			GodPointsService.sendCredit(shopId, 20238699L);
			Thread.sleep(500);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			OrderVo orderVo = placeOrderReq.getOrderGroups().get(0).getOrders()
					.get(0);

			// 添加第二个商品
			orderVo.getOrderItems().add(
					SqTradingCallService.createOrderItemVo(productBean
							.getProductId(), productBean.getCatalogList()
							.get(1)));

			placeOrderReq.setIntegral(100L);
			placeOrderReq.setShenqiProxyBuyOrder(true);
			placeOrderReq.setIntegralServiceType(1);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_136() {
		Logger.start(true, "盛付通用户一次下单一个商品,店主订单利润为负，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createShengPayProxychain(500381009, 1);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, 500381009);

			placeOrderReq.setPayChannelType(2);
			placeOrderReq.setCurrency(productBean.getCurrency());

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setProductPrice(new BigDecimal(productBean
					.getAgentCatalogPriceList().get(0).getDirectPrice()));
			orderItemVo.setProductNum(1);

			placeOrderReq.setDiscount(new BigDecimal("0.01").negate());

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(201, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(114, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true, placeorderCall.getMsg()
					.contains("订单折扣过低"), "校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_137() {
		Logger.start(true, "盛付通用户一次下单多个商品,店主某个商品利润为负，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createShengPayProxychain(500381009, 1);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, 500381009);

			placeOrderReq.setPayChannelType(2);
			placeOrderReq.setCurrency(productBean.getCurrency());

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo.setProductPrice(new BigDecimal(productBean
					.getAgentCatalogPriceList().get(0).getDirectPrice()));
			orderItemVo.setProductNum(1);

			// 添加第二个商品
			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeOrderReq.setDiscount(BigDecimal.ONE.negate());

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("盛付通支付订单，有商品或订单利润为负"),
					"校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_138() {
		Logger.start(true, "代购神器直销商，主商品带换购商品，带有买手优惠券，带有买手优惠，使用积分，使用折扣，下单失败");
		try {
			int mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) mchId, 0, false);

			GodPointsService.saveCreditPolicyReq((long) mchId);
			Thread.sleep(500);

			GodPointsService.sendCredit((long) mchId, 20238699L);
			Thread.sleep(500);

			Integer activityId = SqTradingProductService
					.agentProductAddActivity(productBean, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.TEN, 20238699,
							productBean, productBean.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			orderItemVo1.setExchangeBuyActivityId(activityId);

			placeOrderReq.getOrderGroups().get(0)
					.setServiceRate(new BigDecimal("13.00"));

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));
			orderItemVo2.setProductNum(1);
			orderItemVo2.setExchangeBuy(true);

			orderItemVo2.setExchangeBuyActivityId(activityId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(orderItemVo1.getCatalogId(),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeOrderReq.setIntegral(10L);
			placeOrderReq.setIntegralServiceType(1);
			placeOrderReq.setShenqiProxyBuyOrder(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(201, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(198, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("下单时传入的商家优惠可分摊商品列表数据异常"),
					"校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_139() {
		Logger.start(true, "代购神器直销商，主商品带换购商品，使用折扣，下单成功");
		try {
			int mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) mchId, 0, false);

			Integer activityId = SqTradingProductService
					.agentProductAddActivity(productBean, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.TEN, 20238699,
							productBean, productBean.getSellerId(), false);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			ActivityVo activityVo = new ActivityVo();

			activityVo.setActivityId(activityId);
			activityVo.setActivityTemplateId(5123);
			activityVo.setAfterActivityFinishAccept(true);
			activityVo.setProductInActivityId(1234);

			orderItemVo1.setActivity(activityVo);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProductNum(1);
			orderItemVo2.setExchangeBuy(true);

			orderItemVo2.setActivity(activityVo);
			orderItemVo2.setExchangeBuyActivityId(activityId);
			orderItemVo2.setActivityType(ActivityTypeEnum.EXCHANGE_BUY.getCode());
			orderItemVo2.setExchangeBuyThresholdProducts(Arrays.asList(orderItemVo1.getCatalogId()));
			
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeOrderReq.setDiscount(BigDecimal.TEN);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_148() {
		Logger.start(true, "多个订单，满减数量等于主单所有商品数量，带有买手优惠，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, productBean.getSellerId(), false);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			// orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(3);
			orderItemVo1.setFreight(BigDecimal.ZERO);
			// orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			OrderVo orderVo = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean));

			orderVo.getOrderItems().get(0)
					.setProductPrice(new BigDecimal("1000.00"));
			orderVo.getOrderItems().get(0).setProductNum(1);
			orderVo.getOrderItems().get(0).setFreight(BigDecimal.ZERO);

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);
			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(1);

			sellerPromotion1.setReducedAmount(new BigDecimal(100));
			sellerPromotion1.setType(PromotionTypeEnum.PkgBuy);

			sellerPromotion1.setApportions(Arrays
					.asList(new CatalogApportionVo(productBean.getCatalogList()
							.get(0), 4)));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_149() {
		Logger.start(true, "代购神器直销商，主商品带换购商品，带有买手优惠，下单成功");
		try {
			
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			Integer activityId = SqTradingProductService
					.agentProductAddActivity(productBean, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, productBean.getSellerId(), false);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);
			// orderItemVo1.setProductId("p5278260");
			// orderItemVo1.setCatalogId("c8938425");

			orderItemVo1.setExchangeBuyActivityId(activityId);

			placeOrderReq.getOrderGroups().get(0)
					.setServiceRate(new BigDecimal("13.00"));

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));
			orderItemVo2.setProductNum(1);
			// orderItemVo2.setProductId("p5278260");
			// orderItemVo2.setCatalogId("c8938426");
			orderItemVo2.setExchangeBuy(true);

			orderItemVo2.setExchangeBuyActivityId(activityId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays
					.asList(new CatalogApportionVo(productBean.getCatalogList()
							.get(0), orderItemVo1.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_158() {
		Logger.start(true, "代购神器直销商，1小时内直播订单，下单成功");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);


			String productId = productBean.getProductId();

			// 直播点击上报
			SqUserClickService.userClick(20238699L, productBean.getSellerId(),
					productId);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId, true);

			placeOrderReq
					.getOrderGroups()
					.get(0)
					.getOrders()
					.get(0)
					.getOrderItems()
					.add(SqTradingCallService.createOrderItemVo(
							productBean.getProductId(), productBean
									.getCatalogList().get(1)));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_159() {
		Logger.start(true, "代购神器直销商，1小时以外直播订单，下单成功");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			String productId = productBean.getProductId();

			// 直播点击上报
			SqUserClickService.userClick(20238699L, autotest_goodsOwnerId,
					productId);

			SqUserClickService.updateUserClickAddTime(20238699L,
					autotest_goodsOwnerId, productBean.getProductId(),
					YMTDateUtil.getBeforeOrNextHour(-1));

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_160() {
		Logger.start(true, "代购神器直销商，多个商品，其中一个商品是直播商品，下单成功");
		try {

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			String productId = productBean1.getProductId();

			// 直播点击上报
			SqUserClickService.userClick(20238699L, autotest_goodsOwnerId,
					productId);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean1, autotest_goodsOwnerId);

			// 添加一个非直播商品
			placeOrderReq
					.getOrderGroups()
					.get(0)
					.getOrders()
					.get(0)
					.getOrderItems()
					.add(SqTradingCallService.createOrderItemVo(
							productBean2.getProductId(), productBean2
									.getCatalogList().get(0)));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_161() {
		Logger.start(true, "代购神器直销商，带有买手优惠券，带有买手优惠，带有区域折扣，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.TEN, 20238699,
							productBean, productBean.getSellerId(), true);

			// 设置区域折扣
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setRegionDiscountRatio(new BigDecimal("7.00"));

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			orderItemVo2.setProductPrice(new BigDecimal("2000.00"));
			orderItemVo2.setProductNum(2);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(4991));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(productBean.getCatalogList().get(0),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_162() {
		Logger.start(true, "代购神器代理商，带有买手优惠券，带有买手优惠，带有区域折扣，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.TEN, 20238699,
							productBean, autotest_goodsOwnerId, true);

			// 设置区域折扣
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setRegionDiscountRatio(new BigDecimal("6.00"));

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			orderItemVo2.setProductPrice(new BigDecimal("2000.00"));
			orderItemVo2.setProductNum(2);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(4991));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(productBean.getCatalogList().get(0),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_163() {
		Logger.start(true, "直销商下单组合商品，带有区域折扣，一次下单一个商品,生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) autotest_goodsOwnerId, false, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setRegionDiscountRatio(new BigDecimal("5.00"));
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setSubProduct(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_164() {
		Logger.start(true, "多个订单，满减数量等于主单所有商品数量，带有买手优惠，使用区域折扣，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, productBean.getSellerId(), false);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(3);
			orderItemVo1.setFreight(BigDecimal.ZERO);

			OrderVo orderVo = SqTradingCallService.createOrderVo(Arrays
					.asList(productBean));

			orderVo.setRegionDiscountRatio(new BigDecimal("9.40"));

			orderVo.getOrderItems().get(0)
					.setProductPrice(new BigDecimal("1000.00"));
			orderVo.getOrderItems().get(0).setProductNum(1);
			orderVo.getOrderItems().get(0).setFreight(BigDecimal.ZERO);

			placeOrderReq.getOrderGroups().get(0).getOrders().add(orderVo);
			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(1);

			sellerPromotion1.setReducedAmount(new BigDecimal(100));
			sellerPromotion1.setType(PromotionTypeEnum.PkgBuy);

			sellerPromotion1.setApportions(Arrays
					.asList(new CatalogApportionVo(productBean.getCatalogList()
							.get(0), 4)));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setRegionDiscountRatio(new BigDecimal("9.50"));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_165() {
		Logger.start(true, "代购神器直销商，主商品带换购商品，使用区域折扣，下单成功");
		try {
			int mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) mchId, 0, false);

			Integer activityId = SqTradingProductService
					.agentProductAddActivity(productBean, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.TEN, 20238699,
							productBean, productBean.getSellerId(), false);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductNum(1);

			ActivityVo activityVo = new ActivityVo();

			activityVo.setActivityId(activityId);
			activityVo.setActivityTemplateId(5123);
			activityVo.setAfterActivityFinishAccept(true);
			activityVo.setProductInActivityId(1234);

			orderItemVo1.setActivity(activityVo);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProductNum(1);
			orderItemVo2.setExchangeBuy(true);
			orderItemVo2.setProductPrice(new BigDecimal("0.01"));

			orderItemVo2.setActivity(activityVo);
			orderItemVo2.setExchangeBuyActivityId(activityId);
			orderItemVo2.setActivityType(ActivityTypeEnum.EXCHANGE_BUY
					.getCode());
			orderItemVo2.setExchangeBuyThresholdProducts(Arrays
					.asList(orderItemVo1.getCatalogId()));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setRegionDiscountRatio(new BigDecimal("9.50"));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_166() {
		Logger.start(true, "直销商下单组合商品，带有区域折扣，一次下单一个商品,生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ONE.negate(),
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setProductPrice(BigDecimal.TEN);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setProductNum(1);
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setFullReductionFreeFreight(true);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setRegionDiscountRatio(new BigDecimal("2.00"));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_167() {
		Logger.start(true, "代购神器直销商，优惠券模式为海鲲+代金券，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.TEN, 20238699,
							productBean, productBean.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));

			orderItemVo2.setProductPrice(new BigDecimal("2000.00"));
			orderItemVo2.setProductNum(2);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setCouponSource(CouponSourceEnum.SHOP2CN.getCode());
			couponVo.setCouponType(CouponTypeEnum.CASH_COUPON.getCode());

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(4991));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(productBean.getCatalogList().get(0),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeOrderReq.setIntegralServiceType(2);
			
			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_179() {
		Logger.start(true, "代购神器直销商，1小时内微视直播订单，下单成功");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			String productId = productBean.getProductId();

			// 直播点击上报
			SqUserClickService.userClick(20238699L, productBean.getSellerId(),
					productId, LiveSourceEnum.WEI_SHI.getCode());

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			placeOrderReq
					.getOrderGroups()
					.get(0)
					.getOrders()
					.get(0)
					.getOrderItems()
					.add(SqTradingCallService.createOrderItemVo(
							productBean.getProductId(), productBean
									.getCatalogList().get(1)));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_180() {
		Logger.start(true, "代购神器直销商，1小时以外微视直播订单，下单成功");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			String productId = productBean.getProductId();

			// 直播点击上报
			SqUserClickService.userClick(20238699L, productBean.getSellerId(),
					productId, LiveSourceEnum.WEI_SHI.getCode());

			SqUserClickService.updateUserClickAddTime(20238699L,
					autotest_goodsOwnerId, productBean.getProductId(),
					YMTDateUtil.getBeforeOrNextHour(-1));

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, autotest_goodsOwnerId);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_181() {
		Logger.start(true, "代购神器直销商，多个商品，其中一个商品是微视直播商品，下单成功");
		try {

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			String productId = productBean1.getProductId();

			// 直播点击上报
			SqUserClickService.userClick(20238699L, productBean1.getSellerId(),
					productId, LiveSourceEnum.WEI_SHI.getCode());

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean1, autotest_goodsOwnerId);

			// 添加一个非直播商品
			placeOrderReq
					.getOrderGroups()
					.get(0)
					.getOrders()
					.get(0)
					.getOrderItems()
					.add(SqTradingCallService.createOrderItemVo(
							productBean2.getProductId(), productBean2
									.getCatalogList().get(0)));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_182() {
		Logger.start(true, "代购神器直销商，使用兑换券，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.TEN, 20238699, productBean,
					productBean.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			
			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo1.setDomesticProduct(true);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setApplianceType(CouponApplianceTypeEnum.SPEC_CATALOG);
			couponVo.setCouponType(5);
			couponVo.setApplianceTargets(Arrays.asList(orderItemVo1
					.getCatalogId()));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_183() {
		Logger.start(true, "代购神器直销商，跨境商品使用兑换券，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.TEN, 20238699, productBean,
					productBean.getSellerId(), true);

			placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).setCrossBorderType(1);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			
			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setApplianceType(CouponApplianceTypeEnum.SPEC_CATALOG);
			couponVo.setCouponType(5);
			couponVo.setApplianceTargets(Arrays.asList(orderItemVo1
					.getCatalogId()));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("跨境商品不能使用兑换券"),
					"校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_184() {
		Logger.start(true, "代购神器直销商，使用兑换券，使用商家优惠，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.TEN, 20238699, productBean,
					productBean.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			
			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo1.setDomesticProduct(true);
			
			OrderItemVo orderItemVo2 = SqTradingCallService.createOrderItemVo(
					productBean.getProductId(), productBean.getCatalogList()
							.get(1));
			
			orderItemVo2.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo2.setProductNum(1);
			orderItemVo2.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo2.setDomesticProduct(true);
			
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setApplianceType(CouponApplianceTypeEnum.SPEC_CATALOG);
			couponVo.setCouponType(5);
			couponVo.setApplianceTargets(Arrays.asList(orderItemVo1
					.getCatalogId()));
			
			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays
					.asList(new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_185() {
		Logger.start(true, "代购神器代理商，跨境商品使用兑换券，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);
			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.TEN, 20238699, productBean,
					autotest_goodsOwnerId, true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			
			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo1.setDomesticProduct(true);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setApplianceType(CouponApplianceTypeEnum.SPEC_CATALOG);
			couponVo.setCouponType(5);
			couponVo.setApplianceTargets(Arrays.asList(orderItemVo1
					.getCatalogId()));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals(true,
					placeorderCall.getMsg().contains("代理商品不能使用兑换券"),
					"校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_186() {
		Logger.start(true, "代购神器直销商，多个商品，使用兑换券，使用折扣，使用满减优惠，使用区域折扣，使用积分，下单成功");
		try {
			
			int mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) mchId, 0, false);

			GodPointsService.saveCreditPolicyReq((long) mchId);
			Thread.sleep(500);

			GodPointsService.sendCredit((long) mchId, 20238699L);
			Thread.sleep(500);
			
			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.TEN, 20238699, productBean,
					productBean.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			
			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(3);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo1.setDomesticProduct(true);
			orderItemVo1.setFullReductionFreeFreight(true);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.setRegionDiscountRatio(new BigDecimal("7.00"));

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setApplianceType(CouponApplianceTypeEnum.SPEC_CATALOG);
			couponVo.setCouponType(5);
			couponVo.setApplianceTargets(Arrays.asList(orderItemVo1
					.getCatalogId()));
			
			placeOrderReq.setShenqiProxyBuyOrder(true);
			placeOrderReq.setIntegral(10L);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	// riskstatus为2，待查
	public void Tc_DGSQPlaceOrder_187() {
		Logger.start(true, "代购神器直销商，使用兑换券，0元支付，下单并自动支付成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.ZERO, 20238699, productBean,
					productBean.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			
			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo1.setDomesticProduct(true);
			orderItemVo1.setFreight(null);
			
			placeOrderReq.getOrderGroups().get(0).getOrders().get(0).setRegionDiscountRatio(new BigDecimal("8.00"));

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setApplianceType(CouponApplianceTypeEnum.SPEC_CATALOG);
			couponVo.setCouponType(5);
			couponVo.setApplianceTargets(Arrays.asList(orderItemVo1
					.getCatalogId()));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_188() {
		Logger.start(true, "代购神器直销商，1小时内直播订单，使用兑换券，下单成功");
		try {

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, false);

			String productId = productBean.getProductId();

			// 直播点击上报
			SqUserClickService.userClick(20238699L, productBean.getSellerId(),
					productId);

			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.ZERO, 20238699, productBean,
					productBean.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(3);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo1.setDomesticProduct(true);
			orderItemVo1.setFreight(BigDecimal.ZERO);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setApplianceType(CouponApplianceTypeEnum.SPEC_CATALOG);
			couponVo.setCouponType(5);
			couponVo.setApplianceTargets(Arrays.asList(orderItemVo1
					.getCatalogId()));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_189() {
		Logger.start(true, "直销商下单组合商品, 使用兑换券，生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) autotest_goodsOwnerId, false, false);

			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.ZERO, 20238699, productBean,
					productBean.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(2);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo1.setDomesticProduct(true);
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo1.setSubProduct(true);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setApplianceType(CouponApplianceTypeEnum.SPEC_CATALOG);
			couponVo.setCouponType(5);
			couponVo.setApplianceTargets(Arrays.asList(orderItemVo1
					.getCatalogId()));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_190() {
		Logger.start(true, "直销商下单组合商品，一次下单多个商品, 使用兑换券，生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) autotest_goodsOwnerId, false, false);

			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.ZERO, 20238699, productBean,
					productBean.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(3);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo1.setDomesticProduct(true);
			orderItemVo1.setFreight(BigDecimal.ZERO);
			orderItemVo1.setSubProduct(true);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setApplianceType(CouponApplianceTypeEnum.SPEC_CATALOG);
			couponVo.setCouponType(5);
			couponVo.setApplianceTargets(Arrays.asList(orderItemVo1
					.getCatalogId()));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_191() {
		Logger.start(true, "直销商一次下单一个虚拟库存商品,使用兑换券，生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			OrderItemVo orderItemVo = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			// 实际库存12 + 虚拟库存2
			orderItemVo.setProductNum(12);
			orderItemVo.setVirtualProductNum(2);

			orderItemVo.setProductPrice(BigDecimal.TEN);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_192() {
		Logger.start(true, "代购神器直销商，使用兑换券，使用商家优惠单规格商品，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.TEN, 20238699, productBean,
					productBean.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			
			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(10);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);
			orderItemVo1.setDomesticProduct(true);
			
//			OrderItemVo orderItemVo2 = SqTradingCallService.createOrderItemVo(
//					productBean.getProductId(), productBean.getCatalogList()
//							.get(1));
//			
//			orderItemVo2.setProductPrice(new BigDecimal("1000.00"));
//			orderItemVo2.setProductNum(1);
//			orderItemVo2.setPrimeCostPrice(BigDecimal.TEN);
//			orderItemVo2.setDomesticProduct(true);
			
//			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
//					.getOrderItems().add(orderItemVo2);

			CouponVo couponVo = placeOrderReq.getOrderGroups().get(0)
					.getSellerCoupon();

			couponVo.setApplianceType(CouponApplianceTypeEnum.SPEC_CATALOG);
			couponVo.setCouponType(5);
			couponVo.setApplianceTargets(Arrays.asList(orderItemVo1
					.getCatalogId()));
			
			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfCountEnough);

			sellerPromotion1.setApportions(Arrays
					.asList(new CatalogApportionVo(orderItemVo1.getCatalogId(),
							orderItemVo1.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_193() {
		Logger.start(true, "代购神器直销商，带有多张买手优惠券，带有买手优惠，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.TEN, 20238699, productBean,
					productBean.getSellerId(), false);
			
			CouponVo couponVo1 = SqTradingCallService.createSellerCouponVo(
					20238699L, autotest_goodsOwnerId, new BigDecimal("50.00"),
					BigDecimal.TEN);

			CouponVo couponVo2 = SqTradingCallService.createSellerCouponVo(
					20238699L, autotest_goodsOwnerId, new BigDecimal("50.00"),
					new BigDecimal("15.00"));
			
			couponVo2.setCouponType(CouponTypeEnum.FULL_DISCOUNT_COUPON
					.getCode());
			
			placeOrderReq.getOrderGroups().get(0)
					.setSellerCoupons(Arrays.asList(couponVo1, couponVo2));

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			// orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setProductPrice(new BigDecimal("1000.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			// orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));
			orderItemVo2.setProductPrice(new BigDecimal("2000.00"));
			orderItemVo2.setProductNum(2);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(20));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(productBean.getCatalogList().get(0),
							orderItemVo1.getProductNum()),
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_194() {
		Logger.start(true, "渠道商一次下单一个商品，CrossBorderType = 1，生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 2, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0).setCrossBorderType(1);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_195() {
		Logger.start(true, "渠道商一次下单一个商品，境内商品，CrossBorderType = 1，生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 1, true);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean, (int) autotest_goodsOwnerId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0).setCrossBorderType(1);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().get(0).setDomesticProduct(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_196() {
		Logger.start(true, "代购神器直销商，带有多张买手满减优惠券，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.TEN, 20238699, productBean,
					productBean.getSellerId(), false);
			
			CouponVo couponVo1 = SqTradingCallService.createSellerCouponVo(
					20238699L, autotest_goodsOwnerId, new BigDecimal("50.00"),
					BigDecimal.TEN);

			CouponVo couponVo2 = SqTradingCallService.createSellerCouponVo(
					20238699L, autotest_goodsOwnerId, new BigDecimal("50.00"),
					new BigDecimal("15.00"));
			
			placeOrderReq.getOrderGroups().get(0)
					.setSellerCoupons(Arrays.asList(couponVo1, couponVo2));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals("同一类型商家优惠券/码数量不能大于1", placeorderCall.getMsg(),
					"校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_197() {
		Logger.start(true, "代购神器直销商，带有多张买手满折优惠券，下单失败");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.TEN, 20238699, productBean,
					productBean.getSellerId(), false);

			CouponVo couponVo1 = SqTradingCallService.createSellerCouponVo(
					20238699L, autotest_goodsOwnerId, new BigDecimal("50.00"),
					new BigDecimal("5.00"));

			couponVo1.setCouponType(CouponTypeEnum.FULL_DISCOUNT_COUPON
					.getCode());

			CouponVo couponVo2 = SqTradingCallService.createSellerCouponVo(
					20238699L, autotest_goodsOwnerId, new BigDecimal("50.00"),
					new BigDecimal("5.00"));

			couponVo2.setCouponType(CouponTypeEnum.FULL_DISCOUNT_COUPON
					.getCode());
			
			placeOrderReq.getOrderGroups().get(0)
					.setSellerCoupons(Arrays.asList(couponVo1, couponVo2));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			Logger.verifyEquals(400, placeorderCall.getCode(), "校验code");
			Logger.verifyEquals(100, placeorderCall.getBcode(), "校验bcode");

			Logger.verifyEquals("同一类型商家优惠券/码数量不能大于1", placeorderCall.getMsg(),
					"校验msg");
			Logger.verifyEquals(false,
					placeorderCall.getData().getBoolean("success"), "校验success");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_198() {
		Logger.start(true, "代购神器直销商，多个订单，多个商品，带有多张买手优惠券，下单成功");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.TEN, 20238699, productBean,
					productBean.getSellerId(), false);
			
			CouponVo couponVo1 = SqTradingCallService.createSellerCouponVo(
					20238699L, autotest_goodsOwnerId, new BigDecimal("50.00"),
					BigDecimal.TEN);

			CouponVo couponVo2 = SqTradingCallService.createSellerCouponVo(
					20238699L, autotest_goodsOwnerId, new BigDecimal("50.00"),
					new BigDecimal("15.00"));
			
			couponVo2.setCouponType(CouponTypeEnum.FULL_DISCOUNT_COUPON
					.getCode());

			OrderItemVo orderItemVo2 = SqTradingCallService.createOrderItemVo(
					productBean.getProductId(), productBean.getCatalogList()
							.get(1));

			orderItemVo2.setProductPrice(new BigDecimal("2000.00"));
			orderItemVo2.setProductNum(2);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);
			
			placeOrderReq.getOrderGroups().get(0)
					.setSellerCoupons(Arrays.asList(couponVo1, couponVo2));
			
			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			
			// 添加第二个订单
			placeOrderReq
					.getOrderGroups()
					.get(0)
					.getOrders()
					.add(SqTradingCallService.createOrderVo(Arrays
							.asList(productBean1)));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_199() {
		Logger.start(true, "代购神器直销商，主商品带换购商品，使用叠加优惠券，下单成功");
		try {
			
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			Integer activityId = SqTradingProductService
					.agentProductAddActivity(productBean, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.TEN, 20238699,
							productBean, productBean.getSellerId(), false);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			ActivityVo activityVo = new ActivityVo();

			activityVo.setActivityId(activityId);
			activityVo.setActivityTemplateId(5123);
			activityVo.setAfterActivityFinishAccept(true);
			activityVo.setProductInActivityId(1234);

			orderItemVo1.setActivity(activityVo);
			orderItemVo1.setExchangeBuyActivityId(activityId);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			orderItemVo2.setProductNum(1);
			orderItemVo2.setExchangeBuy(true);

			orderItemVo2.setActivity(activityVo);
			orderItemVo2.setExchangeBuyActivityId(activityId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			CouponVo couponVo1 = SqTradingCallService.createSellerCouponVo(
					20238699L, autotest_goodsOwnerId, new BigDecimal("50.00"),
					BigDecimal.TEN);

			CouponVo couponVo2 = SqTradingCallService.createSellerCouponVo(
					20238699L, autotest_goodsOwnerId, new BigDecimal("50.00"),
					new BigDecimal("15.00"));
			
			couponVo2.setCouponType(CouponTypeEnum.FULL_DISCOUNT_COUPON
					.getCode());
			
			placeOrderReq.getOrderGroups().get(0)
					.setSellerCoupons(Arrays.asList(couponVo1, couponVo2));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_200() {
		Logger.start(true, "代购神器直销商，主商品带满赠商品，带有买手优惠券，使用积分，使用折扣，下单成功");
		try {
			int mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) mchId, 0, false);

			GodPointsService.saveCreditPolicyReq((long) mchId);
			Thread.sleep(500);

			GodPointsService.sendCredit((long) mchId, 20238699L);
			Thread.sleep(500);

			Integer activityId = SqTradingProductService
					.agentProductAddActivity(productBean, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.TEN, 20238699,
							productBean, productBean.getSellerId(), true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			placeOrderReq.getOrderGroups().get(0)
					.setServiceRate(new BigDecimal("13.00"));

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean.getProductId(), productBean
							.getCatalogList().get(1));
			
			orderItemVo2.setProductPrice(BigDecimal.ZERO);
			orderItemVo2.setExchangeBuy(true);
			orderItemVo2.setExchangeBuyActivityId(activityId);
			orderItemVo2.setActivityType(ActivityTypeEnum.EXCHANGE_GIVE.getCode());
			orderItemVo2.setExchangeBuyThresholdProducts(Arrays.asList(orderItemVo1.getCatalogId()));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			placeOrderReq.setIntegral(10L);
			placeOrderReq.setIntegralServiceType(1);
			placeOrderReq.setShenqiProxyBuyOrder(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_201() {
		Logger.start(true, "代购神器直销商，一元购，带有买手优惠，下单成功");
		try {
			
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			Integer activityId = SqTradingProductService
					.agentProductAddActivity(productBean, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.ZERO, 20238699,
							productBean, productBean.getSellerId(), false);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			placeOrderReq.getOrderGroups().get(0)
					.setServiceRate(new BigDecimal("13.00"));

			OrderItemVo orderItemVo2 = SqTradingCallService.createOrderItemVo(
					productBean.getProductId(), productBean.getCatalogList()
							.get(1));
			orderItemVo2.setProdTaxRate(new BigDecimal("0.47"));
			orderItemVo2.setProductNum(1);
			orderItemVo2.setProductPrice(BigDecimal.ONE);
			orderItemVo2.setExchangeBuy(true);
			orderItemVo2.setActivityType(ActivityTypeEnum.ONE_YUAN_GIFT
					.getCode());
			orderItemVo2.setExchangeBuyThresholdProducts(Arrays
					.asList(orderItemVo1.getCatalogId()));
			orderItemVo2.setExchangeBuyActivityId(activityId);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(100));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动");

			sellerPromotion1.setPromotionValue(new BigDecimal(12));
			sellerPromotion1.setQtyCondition(4);

			sellerPromotion1.setReducedAmount(new BigDecimal(15));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays
					.asList(new CatalogApportionVo(productBean.getCatalogList()
							.get(0), orderItemVo1.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			this.verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_202() {
		Logger.start(true, "代购神器直销商，同一个订单带有多个满赠、一元购、换购活动，下单成功");
		try {
			int mchId = DGSQBaseService.createIndependenceMch("USA");

			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createProxychain((int) mchId, 0, false);

			Integer activityId1 = SqTradingProductService
					.agentProductAddActivity(productBean1, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(0, BigDecimal.TEN, 20238699,
							productBean1, productBean1.getSellerId(), false);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);
			orderItemVo1.setProdTaxRate(new BigDecimal("0.17"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setPrimeCostPrice(BigDecimal.TEN);

			placeOrderReq.getOrderGroups().get(0)
					.setServiceRate(new BigDecimal("13.00"));

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean1.getProductId(), productBean1
							.getCatalogList().get(1));
			
			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createProxychain((int) mchId, 0, false);

			OrderItemVo orderItemVo3 = SqTradingCallService.createOrderItemVo(
					productBean2.getProductId(), productBean2.getCatalogList()
							.get(0));

			orderItemVo3.setProductPrice(BigDecimal.ZERO);
			orderItemVo3.setExchangeBuy(true);
			orderItemVo3.setExchangeBuyActivityId(activityId1);
			orderItemVo3.setActivityType(ActivityTypeEnum.EXCHANGE_GIVE
					.getCode());
			orderItemVo3.setExchangeBuyThresholdProducts(Arrays.asList(
					orderItemVo1.getCatalogId(), orderItemVo2.getCatalogId()));
			
			OrderItemVo orderItemVo4 = SqTradingCallService.createOrderItemVo(
					productBean2.getProductId(), productBean2.getCatalogList()
							.get(1));
				
			AgentProductBean productBean3 = DGSQBuildProxyChainCallService
					.createProxychain((int) mchId, 0, false);
			
			Integer activityId2 = SqTradingProductService
					.agentProductAddActivity(productBean3, false);
			
			OrderItemVo orderItemVo5 = SqTradingCallService.createOrderItemVo(
					productBean3.getProductId(), productBean3.getCatalogList()
							.get(0));
			
			OrderItemVo orderItemVo6 = SqTradingCallService.createOrderItemVo(
					productBean3.getProductId(), productBean3.getCatalogList()
							.get(1));
			
			orderItemVo6.setProductPrice(BigDecimal.ONE);
			orderItemVo6.setExchangeBuy(true);
			orderItemVo6.setExchangeBuyActivityId(activityId2);
			orderItemVo6.setActivityType(ActivityTypeEnum.ONE_YUAN_GIFT
					.getCode());
			orderItemVo6.setExchangeBuyThresholdProducts(Arrays.asList(
					orderItemVo4.getCatalogId(), orderItemVo5.getCatalogId()));

			List<OrderItemVo> orderItems = placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems();
			
			orderItems.add(orderItemVo2);
			orderItems.add(orderItemVo3);
			orderItems.add(orderItemVo4);
			orderItems.add(orderItemVo5);
			orderItems.add(orderItemVo6);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_203() {
		Logger.start(true, "平台供货商，多个商品，生成一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createPlatformProxychain(
							(int) platformSupplierGoodsOwnerId, 1, false, "CNY");
			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.ZERO, 20238699, productBean,
					platformSupplierGoodsOwnerId);

			OrderItemVo orderItemVo = SqTradingCallService.createOrderItemVo(
					productBean.getProductId(), productBean.getCatalogList()
							.get(1));

//			orderItemVo.setProductPrice(new BigDecimal(productBean
//					.getAgentCatalogPriceList().get(1).getAgentPrice()));

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo);

			placeOrderReq.setDiscount(new BigDecimal("10.00"));
			placeOrderReq.setGuideOrder(true);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_204() {
		Logger.start(true, "平台供货商，多个商品，生成多个订单");
		try {
			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createPlatformProxychain(
							(int) platformSupplierGoodsOwnerId, 1, false, "CNY");
			
			placeOrderReq = SqTradingCallService.buildDGSQStandPlaceOrderReq(0,
					BigDecimal.ZERO, 20238699, productBean1,
					platformSupplierGoodsOwnerId);
			
			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			
			placeOrderReq
					.getOrderGroups()
					.get(0)
					.getOrders()
					.add(SqTradingCallService.createOrderVo(Arrays
							.asList(productBean2)));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_205() {
		Logger.start(true, "直销商下单多个优惠，多商品，生成一个订单");
		try {
			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean1, (int) autotest_goodsOwnerId, true);

			OrderItemVo orderItemVo1 = placeOrderReq.getOrderGroups().get(0)
					.getOrders().get(0).getOrderItems().get(0);

			orderItemVo1.setProductPrice(new BigDecimal("426.00"));
			orderItemVo1.setProductNum(1);
			orderItemVo1.setFullReductionFreeFreight(true);

			OrderItemVo orderItemVo2 = SqTradingCallService
					.createOrderItemVo(productBean2.getProductId(), productBean2
							.getCatalogList().get(0));

			orderItemVo2.setProductPrice(new BigDecimal("679.00"));
			orderItemVo2.setProductNum(7);
			orderItemVo2.setFullReductionFreeFreight(true);

			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems().add(orderItemVo2);

			// 定义买手下的优惠商品信息list
			List<SellerPromotionVo> sellerPromotionList = new ArrayList<SellerPromotionVo>();

			SellerPromotionVo sellerPromotion1 = new SellerPromotionVo();

			sellerPromotion1.setAmountCondition(new BigDecimal(3000));
			sellerPromotion1.setId(123456789);
			sellerPromotion1.setName("自动化商家优惠活动1");

			sellerPromotion1.setPromotionValue(new BigDecimal(300));
			sellerPromotion1.setQtyCondition(0);

			sellerPromotion1.setReducedAmount(new BigDecimal(300));
			sellerPromotion1.setType(PromotionTypeEnum.ReduceIfAmountEnough);

			sellerPromotion1.setApportions(Arrays.asList(
					new CatalogApportionVo(orderItemVo2.getCatalogId(),
							orderItemVo2.getProductNum())));

			// 定义买手下的优惠商品信息list
			SellerPromotionVo sellerPromotion2 = new SellerPromotionVo();

			sellerPromotion2.setAmountCondition(new BigDecimal(3000));
			sellerPromotion2.setId(97087);
			sellerPromotion2.setName("自动化商家优惠活动1");

			sellerPromotion2.setPromotionValue(new BigDecimal("0.8"));
			sellerPromotion2.setQtyCondition(1);

			sellerPromotion2.setReducedAmount(new BigDecimal("85.2"));
			sellerPromotion2.setType(PromotionTypeEnum.DiscountIfCountEnough);

			sellerPromotion2.setApportions(Arrays.asList(
					new CatalogApportionVo(orderItemVo1.getCatalogId(),
							orderItemVo1.getProductNum())));

			sellerPromotionList.add(sellerPromotion1);
			sellerPromotionList.add(sellerPromotion2);

			placeOrderReq.getOrderGroups().get(0)
					.setSellerPromotionApportions(sellerPromotionList);

			CouponVo coupon = placeOrderReq.getOrderGroups().get(0).getSellerCoupon();

			coupon.setCouponType(1);
			coupon.setCouponSource(0);
			coupon.setCouponValue(new BigDecimal("45.00"));
			coupon.setApplianceType(CouponApplianceTypeEnum.SPEC_RODUCT);
			coupon.setApplianceTargets(Arrays.asList(orderItemVo1.getProductId()));

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_TEST() {
		Logger.start(true, "渠道商一次下单一个商品, 导购订单，生产一个订单");
		try {
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);
			
			ArrayList<PlaceOrderCall> list = new ArrayList<>();
			
			for (int i = 0; i < 10; i++) {

				placeOrderReq = SqTradingCallService
						.buildDGSQStandPlaceOrderReq(autotest_goodsOwnerId,
								BigDecimal.ZERO, 20238699, productBean,
								(int) autotest_goodsOwnerId);

				placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
						.getOrderItems().get(0).setProductNum(1);

				PlaceOrderCall placeorderCall = new PlaceOrderCall();

				placeorderCall.setData(placeOrderReq);

				list.add(placeorderCall);
			}

			for (PlaceOrderCall call : list) {
				call.callService();
			}

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_TTTT() {
		Logger.start(true, "直销商下单组合商品，一次下单一个商品,生产一个订单");
		try {
			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) autotest_goodsOwnerId, false, false);
			
			AgentProductBean productBean2 = DGSQBuildProxyChainCallService
					.createComposeProductProxychain(
							(int) autotest_goodsOwnerId, false, false);
			
			AgentProductBean productBean3 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean1, (int) autotest_goodsOwnerId);
			
			List<OrderItemVo> items = placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
					.getOrderItems();

			items.get(0).setSubProduct(true);
			
			items.add(SqTradingCallService.createOrderItemVo(productBean2
					.getProductId(), productBean2.getCatalogList().get(0)));
			
			items.get(1).setSubProduct(true);
			
			items.add(SqTradingCallService.createOrderItemVo(productBean3
					.getProductId(), productBean3.getCatalogList().get(0)));
			
			items.get(2).setSubProduct(false);
			

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

			verify();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_DGSQPlaceOrder_TTTT1() {
		Logger.start(true, "直销商下单组合商品，一次下单一个商品,生产一个订单");
		try {
			AgentProductBean productBean1 = DGSQBuildProxyChainCallService
					.createProxychain((int) autotest_goodsOwnerId, 0, false);

			placeOrderReq = SqTradingCallService
					.buildDGSQStandPlaceOrderReq(4321, BigDecimal.ZERO,
							20238699, productBean1, (int) autotest_goodsOwnerId);

			placeorderCall.setData(placeOrderReq);
			placeorderCall.callService();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	public static void main(String[] args) {
	}
}
